This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa/cli] s/NO_FUNCTION/NULL/


> Date: Mon, 21 Jan 2002 13:36:52 -0500
>> From: Andrew Cagney <ac131313@cygnus.com>
>> 
>> My ISO C is pretty rusty, however my memory is that NULL is very very 
>> special.
> 
> 
> In C++, but not in C, IIRC.
> 
> 
>> GDB built with GCC 3.0.3.  Using current GCC things died mysteriously 
>> part way through the build.
> 
> 
> Well, until GCC 3.1 can compile the whole thing, I guess we don't
> have to worry.


I went and asked.  The following is of course third hand:

In C++, NULL can't be ``(void*)0''.  It should be ``0'' but GCC likes to 
define it to ``__null''.  The latter is a special constant with magic 
properties that lets GCC verify that NULL is being used correctly.

In C, NULL is typically ``(void*)0''.  What ever it is, it must be 
compatible with both data and code pointers.

I think this makes using NULL more robust than NO_FUNCTION?

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]