http://d.puremagic.com/issues/show_bug.cgi?id=8901


hst...@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hst...@quickfur.ath.cx


--- Comment #1 from hst...@quickfur.ath.cx 2012-10-27 13:21:36 PDT ---
I don't understand, why should this work?

D arrays are not the same as C arrays; casting an int into an array does not
magically make it an array of bytes.

If you want to get the byte representation, you need to do something like this:

int a = 1234;
ubyte* ptr = cast(ubyte*)&a;
writeln(ptr[0 .. int.sizeof]);

Note, though, that this is unsafe, and is generally not recommended in D code,
unless you're writing low-level code.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to