This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cpplib: Preliminary implementation of UCNs


Neil Booth <neil at daikokuya dot co dot 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 6.10.3.2 paragraph 2, that should print

\u00c0 \u00C0 À

so some tracking is needed inside cpplib.

-- 
- Geoffrey Keating <geoffk at geoffk dot org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]