4-character literal
Bill Baxter
dnewsgroup at billbaxter.com
Sat Jan 27 01:36:32 PST 2007
Anders F Björklund wrote:
> Bill Baxter wrote:
>
>> Besides isn't the value of a multi-character literal going to be
>> dependent on the endianness of the machine you're running on?
>
> Not really, it just gets flipped when _stored_ on a LittleEndian...
> i.e. the char const 'ABCD' is the same as the hex const 0x41424344
>
> In arch i386 this would read 44434241 but in arch ppc it's 41424344.
> That is, if you were to store it somewhere or look at the objectfile.
>
> --anders
Yeh, ok. I'm thinking of the case where you read in a 4-byte uint
signature from a file. If you load it in as a uint, you have to watch
out for the endianness of the file vs that of the platform you're
running on.
Or just compare as a sequence of chars rather than uint.
--bb
More information about the Digitalmars-d
mailing list