Mail Archives: djgpp-workers/1998/03/24/09:15:04
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 -