C++ definition of NULL

Doug Semler doug@seaspace.com
Wed Mar 31 23:46:00 GMT 1999


(Sorry about this follow up but....)

I meant to sea continuing on....NULL only has to be a constant
rvalue which evaluates to an integral value 0....

I could define it as (((((796+372)-345+38))*(562-131+456)).....

you get the idea :)


>
>----- Original Message -----
>From: Chad Gatesman <chadg@redrose.net>
>To: Jason Merrill <jason@cygnus.com>
>Cc: <egcs@cygnus.com>
>Sent: Tuesday, March 02, 1999 9:10 PM
>Subject: Re: C++ definition of NULL
>
>
>>Jason Merrill wrote:
>>
>>>  > I am currently porting a very large library that depends on the
>passing
>>>  > of NULL into parameters declared as long int.
>>>
>>>  > egcs appears to define NULL as __null which is a builtin symbol that
>>>  > treats NULL as `{unknown type} *'.  Therefore, I cannot pass in NULL
>to
>>>  > a long int parameter without casting it.
>>>
>>> Why would you want to?  Conceptually, NULL is a pointer value.
>>
>>I see what you are saying, but unfortunately, this is not my code.  I am
>>mearly porting it.  And, technically, it should work since the standard
>says
>>NULL should be a 0 or 0L
>
>
>Correct ,me if I'm wrong, but the standard says NULL is implementation
>defined, with
>(footnoted) possible values being 0 or 0L but not (void *)0
>
>You should cast, you shouldn't implicitely convert pointers to integers any
>more.... :)
>---
>Doug Semler                       | doug@seaspace.com
>SeaSpace Corporation              | Garbage In -- Gospel Out
>Least Senior Software Developer;  | Minister of things to do Next Quarter
>Low Man on the Totem Pole         | (but will Never Be Done) DNRC  O-
>A closed mind is a terrible thing | Bus Error (passengers dumped)
>
>-----BEGIN GEEK CODE BLOCK-----
>Version: 3.12
>GCS/M d---(pu) s++:- a-- C++ UILSH+++$ P--- L++ E--- W+
>N++ o-- K? w--(++$) O- M-- V- PS+ !PE Y PGP t(+) 5+++ X+
>R- tv+(-) b+(++) DI++++ D G e++>++++ h!>--- r% y+>+++++**
>------END GEEK CODE BLOCK------
>
>
>




More information about the Gcc mailing list