Multichar literals

Adam D. Ruppe destructionator at gmail.com
Fri Nov 12 19:12:12 PST 2010


bearophile wrote:
> What's the purpose of them?

The only thing I can imagine using it for is checking the magic
number in a file header. Like 'ZM' for a DOS exe.

But I'd prefer to just use a regular string for it... an integer
would be easily wrong due to endianness issues. (In the DOS
exe the header actually says 'MZ' if you read the file from
left to right. The PNG magic number is '.PNG' left to right,
but as an integer literal, it would be backward 'GNP.')

Seems like more trouble than its worth to me, but maybe
I'm missing something too.


More information about the Digitalmars-d mailing list