Am 03.01.2010, 12:20 Uhr, schrieb bearophile <[email protected]>:
It's not supposed to work, "dup" allocated memory with malloc, so it's (currently) a run time thing (in future this may change).


So how to "create" an array expression at compile-time to enforce reinterpret_cast instead of conversion?


  // cast array literal
  const short[] ct = cast(short[]) [cast(byte)1, 1];
  writeln(ct);  // writes [1 1]

  // cast other array expression
  short[] rt = cast(short[]) [cast(byte)1, 1].dup;
  writeln(rt);  // writes [257]

Reply via email to