Re: What is a header?

From: Kevin Goodsell (usenet2.spamfree.fusion_at_neverbox.com)
Date: 04/01/04


Date: Thu, 01 Apr 2004 21:07:48 GMT

Julie wrote:

> "Steven T. Hatton" wrote:
>
>>If a header is not necessarily a source file, and the sequences delimited by
>>< and > in header names aren't necessarily valid source file names, what
>>exactly is a header?
>
>
> A header is _necessarily_ a source file that is exclusively distinctly visible
> by the preprocessor.

   2.8 Header names [lex.header]
   header-name:
           <h-char-sequence>
           "q-char-sequence"
   h-char-sequence:
           h-char
           h-char-sequence h-char
   h-char:
           any member of the source character set except
                   new-line and >
   q-char-sequence:
           q-char
           q-char-sequence q-char
   q-char:
           any member of the source character set except
                   new-line and "

1 Header name preprocessing tokens shall only appear within a #include
   preprocessing directive (_cpp.include_). The sequences in both forms
   of header-names are mapped in an implementation-defined manner to
   headers or to external source file names as specified in
   _cpp.include_.

   16.2 Source file inclusion [cpp.include]

1 A #include directive shall identify a header or source file that can
   be processed by the implementation.

2 A preprocessing directive of the form
   # include <h-char-sequence> new-line
   searches a sequence of implementation-defined places for a header
   identified uniquely by the specified sequence between the < and >
   delimiters, and causes the replacement of that directive by the entire
   contents of the header. How the places are specified or the header
   identified is implementation-defined.

I don't see anything here requiring headers to be files. In fact, it
sounds like they went out of their way to make sure that was not implied
(e.g., "header _or_ source file").

-Kevin

-- 
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.


Relevant Pages

  • Re: #include behavior
    ... possibility to place a source file into some place. ... standard header names. ... which ignores the mapping specified by 6.10.2. ... case, for simplicity), then those two mappings map characters sequences ...
    (comp.lang.c)
  • Re: What is a header?
    ... >>A header is an inclusion at the beginning of your source file. ... A class definition, by itself, does not cause the compiler ... Any external class member function definitions ...
    (comp.lang.cpp)
  • Re: Utility to ensure appropriate headers were included
    ... failed to compile. ... This wasn't a problem on most systems because some of the other header ... a header file that's included directly in the source file? ... Your program that happens to use and that calls puts can ...
    (comp.lang.c)
  • Re: Splitting up code ?
    ... compile the first source file and it defines storage for the global ... The opposite situation is that header guards can sometimes cause a source ... functions and global variables. ...
    (comp.lang.c)
  • Re: managing header files
    ... The chances that every source file needs every other source file's header is approximately nil. ... When a system gets to hundreds of source files, this can reduce the compilation time significantly because the compiler reads fewer files. ... while in the .h files the external declarations showed no arguments. ...
    (comp.lang.c.moderated)