[gnu.g++.bug] Pre-defined NULL

cbcscmrs@csun.edu (08/17/89)

In article <8908122236.AA02560@curly> <godard@curly.samsung.com> writes:

>Turns out that NULL is always defined in g++ and gcc...  A -E compile
>shows that NULL is nowhere defined by #define, so it must be preloaded
>in the symbol table.

>The Ansi standard (4.1.5, 4.10) says that NULL is defined in the respective
>library;  it is not a reserved or predeclared word.

Ivan, what version are you using...  To the best of my knowledge gcc
has NEVER done this...  The below reflects what I have always seen in
ANY C compiler I have ever had the pleasure of working with.  Try it
on your compiler...  I suspect the same results.

I would hazard a guess that your understanding of -E is flawed.  Try
grep NULL /usr/include/* and see if any of the file names appear in
the list you get when you g++ -E file.cc | grep '^#'.


Script started on Wed Aug 16 13:08:20 1989
$ cat /tmp/t.cc
main(void) {
    int i = NULL;
}
$ g++ -E /tmp/t.cc
# 1 "/tmp/t.cc"
main(void) {
    int i = NULL;
}
$ g++ /tmp/t.cc -o /tmp/t
In function int main ():
/tmp/t.cc:2: `NULL' was not declared (first use this function)
/tmp/t.cc:2: (Each undeclared identifier is reported only once
/tmp/t.cc:2: for each function it appears in.)
$ exit

script done on Wed Aug 16 13:09:00 1989