Multibyte character constants????
diamond@tkovoa
diamond at tkou02.enet.dec.com
Fri Jun 29 13:59:16 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?
Exactly the opposite. The standard did not even just leave it undefined
by saying nothing. The standard explicitly says that it's undefined.
>For example, if we say
>main(){printf("%d\n",'AB');}
>what should the output be?
It does not have to compile. It does not have to execute. It it does,
it can print anything, or exec rogue.
As a quality-of-implementation issue, a lot of vendors (as extensions)
define a meaning for it, and some of them even tell you what they have
defined. You found some of them:
>We have used different compilers on different machines,
>and all but one gave the same answer: 'A'*256+'B'= 16706
>The odd one out was 'vcc', an ANSI complient compiler for
>ULTRIX. It gave 'B'*256+'A' = 16961.
But it would not be a good idea to depend on this behavior unless you
find a definition in the vendor's manual. And you would not use it
at all in a portable program.
--
Norman Diamond, Nihon DEC diamond at tkou02.enet.dec.com
This is me speaking. If you want to hear the company speak, you need DECtalk.
More information about the Comp.std.c
mailing list