Topic: #include and tokenization [A summary and possible DRs]


Author: gennaro_prota@my-deja.com (Gennaro Prota)
Date: Fri, 3 Aug 2001 17:15:33 GMT
Raw View
Hi everybody,

since our discussion about #include and tokenization pointed out some
possible defects concerning tokenization rules I would like to hear
your opinion before submitting any DR.

First of all I don't take credit for the idea of a DR, which is by
Christopher Eltschka.


Here's a brief list of what should be corrected:

   2.8p1 can be changed to: "Header name preprocessing tokens shall are
only formed within a #include preprocessing directive (16.2)."


This corrects problems concerning both <h-char-sequence> and
"q-char-sequence".

Accordingly, 2.1p3 should mention < and ", so it could be changed to:

"The process of dividing a source file's characters into preprocessing
tokens is context-dependent. [Example: see the handling of < and "
within a #include preprocessing directive. ]


Anyhow, I see another problem regarding the quoted form of #include.
There's an example in the C++ standard (and maybe in the C standard
too) of something like

#define NAME "file.h"
#include NAME

Now I ask, how is this possible if "file.h" is parsed as a
string-literal? And more generally, what is the difference between a
string-literal and a header-name not containing " and newline? The
correction I suggest for 2.1p3 solves the problem, but it still
doesn't make the example above legal.

Am I right? What's your opinion?

P.S. Since I think I will not able to follow the discussion in the
next days I hope someone will submit the DRs (if it doesn't happen
that some guru shows we are all wrong!) :-)


    Genny.




---
[ 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.research.att.com/~austern/csc/faq.html                ]