Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!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 characters Message-ID: <13297@smoke.BRL.MIL> Date: 5 Jul 90 03:33:17 GMT References: <1467@inset.UUCP> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 25 In article <1467@inset.UUCP> mikeb@inset.co.uk (Mike Banahan) writes: >Presumably the integral constant '@' is a three-byte constant, no matter >what it may look like? No, the value of such a multibyte character constant is implementation- defined. The type of the constant is int. >An alternative interpretation is that it violates the constraint in >2.2.1.2 `a .. character constant .. shall begin and end in the initial >shift state', but presumably I can expect my implementation to do the >necessary good deeds and put a shift-out in there too. No, you had better put the shift-out in there too or the final ' may not be recognized by the compiler. >Since it is a three-byte constant (assuming I'm right), then can I be >sure that I do not get overflow when I assign it to a char variable? It is most unlikely that the implementation definition will assign a value less than 256 to '@'. Therefore (assuming that chars are represented in 8 bits, as is usually the case these days), information will be lost if you assign that character constant to a char variable. Situations like this are best dealt with by explicit use of the wchar_t type, which should be large enough to contain any source character.