Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #167673
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: invalid universal character gives error even after #if 0 |
| Date | 2022-09-13 07:52 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <86wna7nx7f.fsf@linuxsc.com> (permalink) |
| References | <temv38$kie6$1@solani.org> <20220830233859.279@kylheku.com> |
Kaz Kylheku <480-992-1380@kylheku.com> writes:
> On 2022-08-31, Philipp Klaus Krause <pkk@spth.de> wrote:
>
>> I noticed that current gcc and clang give an error on the following:
>>
>> #if 0
>> \u003a
>> #endif
>>
>> but not on
>>
>> /*
>> \u003a
>> */
>>
>> While I see that \u003a is a constraint violation, I do not see how it
>> follows from the standard that this is a constraint violation even
>> inside #if 0.
>
> #if 0 isn't a commenting mechanism. The material excluded by #if 0
> has to consist of valid preprocessor tokens, so any token-level
> constraint violations apply. E.g. you can't have an unterminated
> literal in there:
>
> #if 0
> "unterminated
> #endif
>
> A universal characcter name is a constituent of an identifier,
> and an identifier is a kind of preprocessing-token (in the
> early translation stages) which later becomes a token.
A universal character name _may_ be a constituent of an
identifier, but it doesn't have to be. Since the universal
character name \u003a does not fall into one of the ranges
specified in Annex D.1, it is not allowed in an identifier and
therefore is not part of an identifier. Hence it must be treated
by the preprocessor on a character-by-character basis, which
means the leading \ is a "non-white-space character that cannot
be one of the above".
Note also that n3047 adds the case
each universal-character-name that cannot be one of the above
to 6.4 p1 under preprocessing-token, which strengthens the
argument.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
invalid universal character gives error even after #if 0 Philipp Klaus Krause <pkk@spth.de> - 2022-08-31 08:28 +0200
Re: invalid universal character gives error even after #if 0 Kaz Kylheku <480-992-1380@kylheku.com> - 2022-08-31 06:52 +0000
Re: invalid universal character gives error even after #if 0 Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-09-13 07:52 -0700
Re: invalid universal character gives error even after #if 0 Siri Cruise <chine.bleu@yahoo.com> - 2022-08-31 02:13 -0700
Re: invalid universal character gives error even after #if 0 Kaz Kylheku <480-992-1380@kylheku.com> - 2022-08-31 16:51 +0000
Re: invalid universal character gives error even after #if 0 Siri Cruise <chine.bleu@yahoo.com> - 2022-08-31 10:57 -0700
Re: invalid universal character gives error even after #if 0 Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-09-13 07:54 -0700
csiph-web