Multichar literals

Ellery Newcomer ellery-newcomer at utulsa.edu
Fri Nov 12 20:23:45 PST 2010


It doesn't look like he says that 'ABC' is actually an integer.

If he's just expressing a character string as a little endian integer 
(which you see a lot of in e.g. debuggers), then it makes sense.

On 11/12/2010 09:02 PM, bearophile wrote:
> 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