casting array literals doesn't work as stated in the docs

Trass3r mrmocool at gmx.de
Sun Jan 3 02:45:26 PST 2010


Steven Schveighoffer schrieb:
> if you cast an array literal, then it reinterprets each element as if 
> each element were cast to that type.
> 
> otherwise, it's a reinterpret_cast as you say.
> 

Any reason for defining the behavior like that?


The problem is forcing the compiler to reinterpret_cast at compile-time. 
Using .dup like in the docs doesn't work:

http://codepad.org/P9EZ0dIB

without using the ugly
auto PALETTE = (cast(RGBA*) cast(ubyte[]) [0xFF,...]) [0 .. 256];



More information about the Digitalmars-d mailing list