Jarrett Billingsley:
> Wrong types.
Right, I am sorry, thank you for spotting it.
There's the moderate need for a different kind of cast, for collections
(arrays).
At the moment you can do:
import d.func: map, putr, array, xcast;
import std.conv: toInt;
import d.templates: ArrayType1;
void some
On Thu, Mar 12, 2009 at 8:09 AM, bearophile wrote:
> wolftousen wrote:
>> some_function([ x[0], x[1], x[2], x[3] ]);
>
> That may also be written:
> some_function(x[0 .. 4]);
Wrong types.
wolftousen wrote:
> some_function([ x[0], x[1], x[2], x[3] ]);
That may also be written:
some_function(x[0 .. 4]);
Bye,
bearophile
wolftousen wrote:
I have a function defined as:
some_function(int[] array) { ... }; //this function does not ever modify
values of array
When I call this function (once every program cycle) from an object using an
array of type short:
//member variable in an object
short[] x = new short[4];
Jarrett Billingsley wrote:
On Tue, Feb 24, 2009 at 10:42 PM, Daniel Keep
wrote:
You missed the array literal.
I saw that, but thought that it would be a short[] literal since it's
usually the type of the first argument.
Odd, it works. And properly too.
Could it be because of integer promo
On Tue, Feb 24, 2009 at 10:42 PM, Daniel Keep
wrote:
>>
>> You missed the array literal.
>
> I saw that, but thought that it would be a short[] literal since it's
> usually the type of the first argument.
Odd, it works. And properly too.
I give up on trying to figure out what the compiler does
Jarrett Billingsley wrote:
> On Tue, Feb 24, 2009 at 6:45 PM, Daniel Keep
> wrote:
>
>> Maybe it's because I just woke up, but I can't see how that code could
>> compile anyway, since you can't pass a short[] to a function expecting
>> an int[].
>
> You missed the array literal.
I saw that,
On Tue, Feb 24, 2009 at 6:45 PM, Daniel Keep
wrote:
> Maybe it's because I just woke up, but I can't see how that code could
> compile anyway, since you can't pass a short[] to a function expecting
> an int[].
You missed the array literal.
wolftousen wrote:
> I have a function defined as:
>
> some_function(int[] array) { ... }; //this function does not ever modify
> values of array
>
> When I call this function (once every program cycle) from an object using an
> array of type short:
>
> //member variable in an object
> short
I have a function defined as:
some_function(int[] array) { ... }; //this function does not ever modify
values of array
When I call this function (once every program cycle) from an object using an
array of type short:
//member variable in an object
short[] x = new short[4];
//object calls thi
10 matches
Mail list logo