DIPX: Enum Literals / Implicit Selector Expression

Walter Bright newshound2 at digitalmars.com
Fri Jul 1 21:05:50 UTC 2022


On 7/1/2022 12:20 PM, Steven Schveighoffer wrote:
> ```d
> auto a = [1, 2, 3];
> short[] b = [1, 2, 3];
> auto c = cast(short[])a;
> writeln(b); // [1, 2, 3]
> writeln(c); // [1, 0, 2, 0, 3, 0]
> ```
> 
> casting the literal is not the same as casting a regular value of that type.

It's casting the elements, not the array.


More information about the Digitalmars-d mailing list