Re: Automatically generate variables
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 23 Feb 2007 11:59:18 -0800
Beej Jorgensen <beej@xxxxxxx> writes:
In article <qt5st2p2qdkctb7kmq554qdkj7dq6501f8@xxxxxxx>,
Mark McIntyre <markmcintyre@xxxxxxxxxxx> wrote:
If stdlib.h were included, you would know it was a C programme, since
stdlib.h is a standard header.
Or *would* you?
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>
directive, then the behavior is undefined. I suspect that wasn't the
intent. In the absence of 7.1.2p3, such a file wouldn't cause any
problems, because the compiler wouldn't see it. It also implies that
the behavior becomes undefined whether the program attempts to include
the header or not.
Note that, for some implementations, there may be no such places, the
search paths for <foo.h> and "foo.h" might be identical.
I also note that, by creating and installing such a file, I can
magically make my implementation 100% conforming (though not usefully
so); it makes all behavior undefined, so anything the compiler does is
conforming. But the implementation can't take advantage of this
trick, because the file is "not provided as part of the
implementation".
--
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: Automatically generate variables
- From: Richard Bos
- Re: #include behavior (was: Automatically generate variables)
- From: Beej Jorgensen
- Re: Automatically generate variables
- References:
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Yevgen Muntyan
- Re: Automatically generate variables
- From: Mark McIntyre
- Re: Automatically generate variables
- From: Beej Jorgensen
- Re: Automatically generate variables
- Prev by Date: Re: why learn C?
- Next by Date: Re: c and assembler program, help me please!
- Previous by thread: Re: Automatically generate variables
- Next by thread: Re: #include behavior (was: Automatically generate variables)
- Index(es):
Relevant Pages
|