4-character literal

janderson askme at me.com
Thu Jan 25 23:36:05 PST 2007


Rick Mann wrote:
> Rick Mann Wrote:
> 
>> enum : uint
>> {
>>     kSomeConstantValue = 'abcd'
>> }
> 
> 
> I realized I was misunderstanding something else I saw, and that "abcd"d doesn't do what I thought (make a 4-byte character).
> 
> So: how to I do the equivalent of 'abcd'?
> 
> Thanks!


To add to Gregor Richards suggestions, you may try an union (untested).

union Converter { uint asInt; char[4] chr; }
const Converter kSomeConstantValue = { chr : "abcd" };

//To get
kSomeConstantValue.asInt

-Joel



More information about the Digitalmars-d mailing list