www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/24/17:33:10

Message-Id: <m0yHSrw-000S2qC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>, djgpp AT delorie DOT com
Date: Tue, 24 Mar 1998 09:34:48 +0000
MIME-Version: 1.0
Subject: Re: NULL redefined! :(
CC: djgpp-workers AT delorie DOT com
In-reply-to: <3.0.16.19980323234116.32d7668e@hem1.passagen.se>

Peter Palotas <blizzar AT hem1 DOT passagen DOT se> wrote:

> At 11.40 1998-03-23 +0000, you wrote:
> >Peter Palotas <blizzar AT hem1 DOT passagen DOT se> wrote:
> >
> >> It seems as the c-library and the C++ library isn't fully compatible or
> >> something (as of version 2.8.0)... When including <algo.h> or <stack.h> in
> >> my C++ files I get warnings about NULL being redefined in stdlib.h, and
> >> string.h ...
> >
> >The same is for various headers. I fixed various headers at home.
> 
> Well, I simply put an #ifndef NULL around all the NULL redefinitions as
> found by the compiler. The reason I posted this message was to alert people
> working on DJGPP of this problem, and not so much a question on how to
> solve it.

Ok, that's the right procedure. 
Now a little explanation of why it happends:

gcc 2.8.x defines a type __null and the C++ library defines:

#define NULL __null

So when the djgpp library tries it:

#define NULL 0

Gcc detect a redefinition that's contradictory. I didn't checked if the __null 
type is or not C++ specific and what advantage have so I did the same as Peter 
(and Robert did the same):

#ifndef NULL
#define NULL 0
#endif

But perhaps we must investigate if the __null have some advantage and:

1) Define NULL conditionally (no redefinition)
2) If not defined:
a) Test the gcc version, if 2.8.0 define with __null
b) if prior define with 0.

SET

 
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
CQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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