codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
import std.stdio; static const f = [1.34, 6.45, 12.3]; static g = [1.34, 6.45, 12.3]; enum h = [1.34, 6.45, 12.3]; const i = [1.34, 6.45, 12.3]; auto f2 = cast(int[]) f; // auto g2 = cast(int[]) g; // gives non-constant expression auto h2 = cast(int[]) h; auto i2 = cast(int[]) i; void main() { writefln("%s", cast(int[]) [1.34, 6.45, 12.3]); writefln("%s", cast(int[]) f); writefln("%s", cast(int[]) g); writefln("%s", cast(int[]) h); writefln("%s", cast(int[]) i); writefln("%s", f2); writefln("%s", h2); writefln("%s", i2); } /* Output in D2: 1 6 12 1 6 12 -687194767 1073049763 -858993459 1075432652 -1717986918 1076402585 1 6 12 1 6 12 1 6 12 1 6 12 1 6 12 */
Private
[
?
]
Run code