Article View: comp.std.c
Article #1452Re: Multibyte character constants????
From: diamond
Date: Fri, 29 Jun 1990 03:59
Date: Fri, 29 Jun 1990 03:59
28 lines
1803 bytes
1803 bytes
In article <1990Jun28.221927.6823@idt.unit.no> arnej@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@tkou02.enet.dec.com
This is me speaking. If you want to hear the company speak, you need DECtalk.
Technical Details
Message-ID:
<1824@tkou02.enet.dec.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!diamondReferences:
<1990Jun28.221927.6823@idt.unit.no>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!tkou02.enet.dec.com!diamond From: diamond@tkou02.enet.dec.com (diamond@tkovoa) Newsgroups: comp.std.c Subject: Re: Multibyte character constants???? Keywords: Hackers of the world, unite! Message-ID: <1824@tkou02.enet.dec.com> Date: 29 Jun 90 03:59:16 GMT References: <1990Jun28.221927.6823@idt.unit.no> Reply-To: diamond@tkou02.enet.dec.com (diamond@tkovoa) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 28