cpplib: Preliminary implementation of UCNs

Geoff Keating geoffk@geoffk.org
Sun Apr 20 02:57:00 GMT 2003

Neil Booth <neil@daikokuya.co.uk> writes:

> UCNs are presently stored in cpplib in the form they appear in the
> source file.  This is because it's easy for -E output, and I'm not sure
> what we want to do as far as mangling is concerned, and I don't think
> it's a good idea to make \u00aa and \u00AA the same identifier, never
> mind making it the same as the character itself.  I can't find anything
> in the standard that requires making them the same.  Comeau doesn't make
> them the same from what I can see.

I'm not quite sure what you mean by "the same" here.

Certainly, the following is a valid translation unit (assuming you get
the character sets right, the character after the '+' is supposed to
be an accented capital A):

int \u00c0;
int foo(void) { return \u00C0 + À; }

because a UCN only "designates" a character, and identifiers are the
same if they are composed of the same characters.

However, if someone does:

#define STRING(x) #x

printf ("%s %s %s", STRING(\u00c0), STRING(\u00C0), STRING(À));

then by paragraph 2, that should print

\u00c0 \u00C0 À

so some tracking is needed inside cpplib.

- Geoffrey Keating <geoffk@geoffk.org>

More information about the Gcc-patches mailing list