delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/22/19:06:47

Sender: nate AT cartsys DOT com
Message-ID: <35DF24C8.A9C6265B@cartsys.com>
Date: Sat, 22 Aug 1998 13:06:32 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Ted Larsson <f93tela AT dd DOT chalmers DOT se>
CC: djgpp AT delorie DOT com
Subject: Re: Trouble when upgrading to gcc 2.8.1
References: <35D9F7ED DOT AC0455EE AT dd DOT chalmers DOT se>

Ted Larsson wrote:

> Programs seem to compile & link all right, but I have noticed a few
> minor things:
> 
> *  The compiler no longer recognizes the word NULL; gives an error
>    message. Why?

This is a known problem.  G++ 2.8 invented a special keyword `__null'
for null pointers, in order to solve some type-checking problems.  Their
headers #define NULL __null, or something similar.  But DJGPP's headers
unconditionally #define NULL 0 or similar, and so there is a conflict.

There is a philosophical dispute ongoing over this.  DJ feels that G++'s
behavior is wrong, and doesn't want to change DJGPP to work around. 
Others feel differently.

I believe you can include C headers before C++ to avoid this. 
Alternatively, you can wrap each definition of NULL in the DJGPP headers
with #ifndef NULL/#endif.
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019