Article View: comp.std.c
Article #1454Re: Multibyte character constants????
From: Doug Gwyn
Date: Fri, 29 Jun 1990 09:29
Date: Fri, 29 Jun 1990 09:29
15 lines
1261 bytes
1261 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? 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.
Technical Details
Message-ID:
<13268@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwynReferences:
<1990Jun28.221927.6823@idt.unit.no>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Multibyte character constants???? Message-ID: <13268@smoke.BRL.MIL> Date: 29 Jun 90 09:29:56 GMT References: <1990Jun28.221927.6823@idt.unit.no> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15