Multibyte character constants????

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jun 29 19:29:56 AEST 1990


In article <1990Jun28.221927.6823 at idt.unit.no> arnej at solan1.solan.unit.no writes:
>We have stumbled across the subject of multibyte character
>constants.  Is this defined anywhere?  For example, if we
>say
>main(){printf("%d\n",'AB');}
>what should the output be?

This isn't what the standard refers to as "multibyte characters", but
rather is a very old feature of C, probably dating all the way back to
the first C compiler.  The encoding of such a character constant is
allowed to depend on the specific implementation, precisely to allow
for such natural packing variations as you reported.  Note that 'AB'
has the same size as 'A'; in both cases the type of the constant is int.
The use of such multiple-character constants is nonportable and thus
not recommended for general use.



More information about the Comp.std.c mailing list