Topic: C99 probelms


Author: ikosarev@online.ru ("Ivan A. Kosarev")
Date: Wed, 11 May 2005 21:00:04 GMT
Raw View
"Antoine Leca" <root@localhost.invalid> wrote in message
news:427a03a2$0$294$626a14ce@news.free.fr...
> En <news:3dthbgF4aunU1@individual.net>, Ivan A. Kosarev va escriure:

>> The \\ character sequence should be recognized as a backslash
>> sequence that is not introducing a UCN in the pp-string-literal
>
> That was my point exactly.
>
> (The other point about \? has to do with trigraphs, and how to escape
> them;
> I believe it would be valid too. YMMV.)
>
>> and thus should be ignored (that is, skipped) quietly and entirely.
>
> I do not understand you. At any rate, in "sys\\udefault.h", the \ should
> certainly not be ignored (which would result in "sysdefault.h", a very
> different thing). I should be rather be considered, but as a single \,
> occuring between s and u.

Note that the definition for the pp-string-literal and pp-character-constant
grammar entities is for tokenization only. The definition just generalizes
all (double-)quoted entities that could be encountered during tokenization
so there will no need to avoid non-existing escape sequences with
string-literals, s-char-sequences and q-char-sequences when getting them
used in preprocessor directives and _Prgama operators. Neither of the
defined pp entities has semantics (just like pp-numbers) unless they are
converted to string literals, character-constant and other entitites. To
which one each instance of the pp entities should be converted depends on a
context the instance is used in.

>>> Inventing a new class of (different) escape sequences is not likely
>>> to be appreciated by the users.
>>
>> Right, it would make no sence to introduce an alternative set of
>> escape sequences.
>
> Which is precisely what motivated the current words in the first place.
>
> On Unix, \ is expected to announce an escape sequence, always. Thta is,
> nobody will expect anything else to occur, nor would be surprised if a \
> is
> grouped with the following character(s) to form an escape sequence.
>
> OTOH, the long-standing tradition on MS-DOS and its heirs, is to have
> things like
>    #include "sys\types.h"
> to work the same as the more natural
>    #include "sys/types.h"
> (and certainly not to protest about a missing "sys    ypes.h" file).
> So the committee chose, long ago, to allow both behaviours: the present
> redaction reflects this choice. Also, this means that using \ in a header
> names cannot be made portable between Unix and MS-DOS (two heavyweight
> contenders), so it is certainly not strictly conforming.

Note is that different meanings are possible for different contexts with the
pp entities.

For example, if we know that there are no \t escape sequences in the
q-char-sequence, we can remain the character sequence as it is. What is
really important in the proposal is that any backslash sequence, matching or
not matching to an extisting escape sequence,  will cause neither undefined
behaviour nor diagnostics until a pp-string-literal incorporating the
sequence is converted to a corresponding non-pp grammar entinty.

Another important note is that the proposal does not change specified
behaviour, and thus shouldn't break a lot of existing code.

--
Unicals Group -- Development Tools for OEMs
http://www.unicals.com


---
[ 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                       ]