Re: #include behavior (was: Automatically generate variables)
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 23 Feb 2007 14:22:49 -0800
Beej Jorgensen <beej@xxxxxxx> writes:
In article <lntzxcabmx.fsf@xxxxxxxxxxxxxxx>,[...]
Keith Thompson <kst-u@xxxxxxx> wrote:
7.1.2 paragraph 3:
If a file with the same name as one of the above < and > delimited
sequences, not provided as part of the implementation, is placed in
any of the standard places that are searched for included source
files, the behavior is undefined.
Interesting. That says that if I place a "stdlib.h" file in one of
the places searched for a
#include "stdlib.h"
directive but *not* for a
#include <stdlib.h>
Hmmm. That wasn't my read... Elaborate.
Why not for <stdlib.h>, especially since "" is a "superset" (so to
speak) of <>?
Sorry, the scope of the "*not*" was unclear.
Suppose the compiler searches for <foo.h> in /usr/include, and for
"foo.h" in $HOME/include and then /usr/include (these are just
arbitrary examples). 7.1.2p3, as I read it, says that if I place a
"stdlib.h" file in $HOME/include (which, as I wrote above, is one of
the places searched for "stdlib.h", but not one of the places searched
for <stdlib.h>), then the behavior is undefined.
If I place a "stdlib.h" file in /usr/include, of course, it also
causes UB.
And I just noticed that 7.1.2p3 talks about "a file with the same
name", which ignores the mapping specified by 6.10.2. In 6.10.2,
it says that <foo.h> refers to
a header identified uniquely by the specified sequence between the
< and > delimiters
whereas "foo.h" refers to
the source file identified by the specified sequence between the "
delimiter
What does "identified by" mean here? Is "foo.h" actually the *name*
of the file (as would be accepted by fopen(), or is it subject to the
same mapping as <foo.h>?
The implementation shall provide unique mappings for sequences
consisting of one or more letters or digits (as defined in 5.2.1)
followed by a period (.) and a single letter. The first character
shall be a letter. The implementation may ignore the distinctions
of alphabetical case and restrict the mapping to eight significant
characters before the period.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: #include behavior
- From: Yevgen Muntyan
- Re: #include behavior
- References:
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Beej Jorgensen
- Re: Automatically generate variables
- From: Keith Thompson
- Re: #include behavior (was: Automatically generate variables)
- From: Beej Jorgensen
- Re: Automatically generate variables
- Prev by Date: Re: why learn C?
- Next by Date: Re: about far & near keywords in c
- Previous by thread: Re: #include behavior (was: Automatically generate variables)
- Next by thread: Re: #include behavior
- Index(es):
Relevant Pages
|