convert char[4] to uint at compile time

Moritz Warning moritzwarning at web.de
Tue Dec 16 11:50:22 PST 2008


Hi,

I have problems to convert a char[4] to an uint at compile time.
All variations (I've tried) of using an enum crashes dmd:

union pp { char[4] str; uint num; }
const uint x = pp("abcd").num

This does also doesn't work:

const uint x = cast(uint) x"aa aa aa aa";


Any ideas?


More information about the Digitalmars-d-learn mailing list