From -6361154282686051448
X-Google-Thread: f78e5,59c47fe3b9dfca8e
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Path: g2news1.google.com!news4.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.alt.net!comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: "msalters" <Michiel.Salters@logicacmg.com>
Newsgroups: comp.std.c++
Subject: Re: UCNs in phase 1
Organization: http://groups.google.com
Message-ID: <1107172715.062014.235540@z14g2000cwz.googlegroups.com>
References: <1106212184.380589.161860@z14g2000cwz.googlegroups.com>
   <1106313530.204408.11090@z14g2000cwz.googlegroups.com>
   <ct2f6n$ejf$1@new-usenet.uk.sun.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1107172719 7924 127.0.0.1 (31 Jan 2005 11:58:39 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 31 Jan 2005 11:58:39 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: groups-abuse@google.com
Injection-Info: z14g2000cwz.googlegroups.com; posting-host=212.123.206.71;
   posting-account=G8Vn6AwAAAAe3s4qFj7nFOuhEuzTNEir
X-Spamscanner: mailbox8.ucsd.edu  (v1.5 Dec  3 2004 17:34:44, -2.8/5.0 3.0.0)
X-MailScanner: PASSED (v1.2.8 63787 j0VBwd90064304 mailbox8.ucsd.edu)
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
Date: Mon, 31 Jan 2005 12:22:27 CST
Xref: g2news1.google.com comp.std.c++:3995


Stephan Bergmann wrote:
> msalters wrote:
> > neil@daikokuya.co.uk wrote:
> >
> >>In view of lex.phases paragraph 1, given a translation unit
> >>
> >>#define str(x) #x
> >>char array[] = str($);
> >>
> >>what characters should array[] contain?
> >
> >
> > $ isn't in the set of supported characters, so anything would be
legal.
> > (2.2/1 The basic source character set ). An error would be legal as
> > well,
> > in fact I think a diagnostic is required.
>
> Oh, yes, you are probably right:  If $ is translated in phase 1 to
> \u0024 or \U00000024, then it is translated in phase 3 to an
identifier
> preprocessing-token, which is malformed, as "Each
> universal-character-name in an identifier shall designate a character

> whose encoding in ISO 10646 falls into one of the ranges specified in

> Annex E." [2.10/1]
>
> However, if $ is translated in phase 1 to \u00c0...

then it must be treated as if you wrote (2.2/1.1)
#define str(x) #x
char array[] = str(\u00c0);

\u00c0 is a UCN, and a pp-token which cannot be a phase 7 token.
However, in phase 4 the # operator is applied which turns the \u00c0
pp-token into a quoted form ("\\u00c0"). This quoted pp-token will
turn into a string literal in phase 7.

Regards,
Michiel Salters

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



