Constant declarations for mac OSX

Anders F Björklund afb at algonet.se
Thu Feb 23 09:11:02 PST 2006


Thomas Kuehne wrote:

> | template FOUR_CHAR_CODE(char[] cmd){
> |     static if(cmd.length != 4){
> |         pragma(msg, "require 4 chars");
> |         static assert(0);
> |     }else{
> |         const uint FOUR_CHAR_CODE = (cmd[0] << 24) | (cmd[1] << 16) | (cmd[2] << 8) | cmd[3];
> |     }
> | }

Seems to do the trick. (returns 0x636d6473)

--anders



More information about the Digitalmars-d-learn mailing list