Mail Archives: djgpp-workers/1998/03/25/10:51:16
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> On Tue, 24 Mar 1998, Salvador Eduardo Tropea (SET) wrote:
>
> > 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.
>
> 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.
>
> The only thing that bothers me is the case of a C++ code that calls a C
> function and passes it NULL as one of its arguments. Can somebody check
> what does the C function see in that case, and will it compare equal to
> the C's notion of NULL?
I did some experiments last night (I didn't have enough time to create patchs)
and here are what I found:
1) __null exists only in C++ so __cplusplus is needed.
2) Is equivalent to 0, that's:
a) char *foo=0; then (foo==0) is true.
b) passing foo to a C module and making (foo==0) in the C code works OK.
I didn't have the time to check what advantage have __null, but I think is
related with some C++ standard or with some stronger syntax check.
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 -