Multichar literals

bearophile bearophileHUGS at lycos.com
Fri Nov 12 19:02:32 PST 2010


Reading a bit about the C-like language used in the LoseThos Operating System, I have found one thing.

In this language a single quote can encompass multiple characters. 'ABC' is equal to 0x434241.

So it's not the same thing as D Hex Strings, because 'ABC' represents an integral value, so it's a more like a base-256 integer literal :-)

So I guess '' is zero, equals to '\0' (currently in D '' gives a "unterminated character constant" error).

What's the purpose of them?

Bye,
bearophile


More information about the Digitalmars-d mailing list