cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/28/23:45:26

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC 2.8.1 and NULL
Date: Sun, 28 Jun 1998 13:07:46 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 28
Message-ID: <35967862.BCEA0A4D@cs.com>
References: <bWLoegW7sFse-pn2-Fd2thRzLcDIB AT localhost>
NNTP-Posting-Host: ppp127.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gili wrote:
> 
>         Since GCC 2.8.1 (and perhaps a bit earlier) the authors have begun
> using "#define NULL __null".. One problem arises:
> 
> If #include <stdio.h> occures anywhere throughout my code (and since
> it is a very common library, it obviously does) I get the following
> message telling me that stdio.h tried to redefine NULL (which was
> previously defined as __null).. The only way I found around this is to
> stick an "#ifndef ... #endif" block before "#define NULL 0" command in
> <stdio.h>.. But what I'm wondering is, is this conflict suppose to
> exist? Is something wrong with my configuration? What's going on? :)

You may want to try always putting #include <stdio.h> as the first
include statement in your source files.  This allows the C++ libraries
to undefine or redefine NULL as they see fit.

This issue was discussed recently; you may be interested in looking it
up in the mail archives (http://www.delorie.com/djgpp/mail-archives/). 
I don't recall exactly what solution we arrived at.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer/   |
| day be a spectacular MUD...     |       ICQ UIN#:  7406319        |
| Plan: To make Bill Gates suffer |     HEAT User ID:  Fighteer     |
---------------------------------------------------------------------

- Raw text -


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