Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Peter Palotas , djgpp AT delorie DOT com Date: Tue, 24 Mar 1998 09:34:48 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: NULL redefined! :( CC: djgpp-workers AT delorie DOT com In-reply-to: <3.0.16.19980323234116.32d7668e@hem1.passagen.se> Precedence: bulk Peter Palotas wrote: > At 11.40 1998-03-23 +0000, you wrote: > >Peter Palotas 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 or 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