A preprocessing directive of the form
(that does not match the previous form) is permitted
. The preprocessing tokens after
include
in the directive are processed just as in normal text
(i.e., each identifier currently defined as a macro name is replaced by its
replacement list of preprocessing tokens)
. The resulting sequence of preprocessing tokens shall be of the form
An attempt is then made to form a
preprocessing token (
[lex.header]) from the whitespace and the characters
of the spellings of the
;
the treatment of whitespace
is
implementation-defined
. If the attempt succeeds, the directive with the so-formed
is processed as specified for the previous form
. Otherwise, the program is ill-formed, no diagnostic required
. The implementation shall provide unique mappings for
sequences consisting of one or more
nondigits or
digits (
[lex.name])
followed by a period
(
.)
and a single
nondigit. The first character shall not be a
digit. The implementation may ignore distinctions of alphabetical case
.A
#include
preprocessing directive may appear
in a source file that has been read because of a
#include
directive in another file,
up to an
implementation-defined nesting limit
.If the header identified by the
denotes an importable header (
[module.import]),
it is
implementation-defined
whether the
#include preprocessing directive
is instead replaced by an
import directive (
[cpp.import]) of the form
[
Note 3:
An implementation can provide a mechanism for making arbitrary
source files available to the
< > search
. However, using the
< > form for headers provided
with the implementation and the
" " form for sources
outside the control of the implementation
achieves wider portability
. For instance:
#include <stdio.h>
#include <unistd.h>
#include "usefullib.h"
#include "myprog.h"
—
end note]
[
Example 1:
This illustrates macro-replaced
#include
directives:
#if VERSION == 1
#define INCFILE "vers1.h"
#elif VERSION == 2
#define INCFILE "vers2.h"
#else
#define INCFILE "versN.h"
#endif
#include INCFILE
—
end example]