This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: revised proposal for GCC and non-Ascii source files
- To: zack at rabi dot columbia dot edu
- Subject: Re: revised proposal for GCC and non-Ascii source files
- From: Paul Eggert <eggert at twinsun dot com>
- Date: Thu, 31 Dec 1998 14:26:31 -0800 (PST)
- CC: rms at gnu dot org, bothner at cygnus dot com, amylaar at cygnus dot co dot uk, martin at mira dot isdn dot cs dot tu-berlin dot de, gcc2 at gnu dot org, egcs at cygnus dot com, zack at rabi dot columbia dot edu
- References: <199812302258.RAA02871@rabi.phys.columbia.edu>
Date: Wed, 30 Dec 1998 17:58:17 -0500
From: Zack Weinberg <zack@rabi.columbia.edu>
- C9x CD2 unambiguously says \u and \U escapes are to be treated as
Unicode. It also disallows these escapes for certain ranges of
Unicode which encompass all of 7-bit ASCII. That being so, I
propose to encode \u and \U in UTF-8 always.
For UTF-8 locales this is reasonable, but it doesn't work for
non-UTF-8 locales, which is the main point of my revised proposal.
For such locales, your proposal would map UCNs to one encoding, while
the rest of the program would continue to use an incompatible encoding
-- but this would render UCNs useless, as you normally can't mix
encodings like that.
This can be done regardless of the availability of translation
libraries.
If translation libraries are not available, then GCC can and should
fall back to something along the lines that you propose. I call this
fallback behavior the ``GNUC charset'' (soon to be revised to the
``GNUC ctype'') in my proposal.
pragmas affecting the preprocessor (which this is) cannot be
expressed with _Pragma() at all, and neither #pragma nor _Pragma()
can appear in a position that is inconvenient to the parser -- I
think that will translate to "must look like a C
statement-or-declaration".
I missed your message (as I don't get egcs) but will look into it in
the egcs archives. However, even ``must look like a C
statement-or-declaration'' is overly optimistic, since a
charset-changing pragma can change the interpretation of comments. I
see real problems in implementing a charset-changing pragma without
placing draconian restrictions on it.