delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/24/13:14:16

Date: Tue, 24 Mar 1998 11:39:47 -0500 (EST)
Message-Id: <199803241639.LAA06639@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp AT delorie DOT com, djgpp-workers AT delorie DOT com
In-reply-to: <Pine.SUN.3.91.980324171958.22871J-100000@is> (message from Eli
Zaretskii on Tue, 24 Mar 1998 17:23:23 +0300 (IDT))
Subject: Re: NULL redefined! :(

> I think that the C header(s) which define NULL should do so only under 
> "#ifndef __cplusplus".  It is safer to let C++ use its own definition 
> throughout, and leave C at its usual definition.

No, that won't work, because C++ must accept ANSI as well, so the
following MUST be valid C++:

	#include <stdio.h>
	int main()
	{
	  if (fopen("foo", "r") == NULL)
	    whatever();
	}

DJGPP could be more careful about this, by #undef'ing NULL before
setting it (this always succeeds), but any other headers that screw
with the ANSI defined symbols are at fault if they conflict, because
ANSI says which headers define which symbols, not some third-party
library.

- Raw text -


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