This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: On NULL and 0


On 13 March 2007 13:52, Paulo J. Matos wrote:

> Hello,
> 
> When programming, due to my journeys through C++ recently, I've been
> using 0 instead of NULL. Strangely gcc compilation doesn't warn me
> about it. Is it ok to do this? (So far, I had no problems). Is there
> anything I should be aware when using 0 instead of NULL in gcc code?

  Nope.  (This is really a gcc-help@ question, but anyway....)  Zero is
completely acceptable for a null pointer constant in all circumstances
*except* when passing to a varargs function, which can go badly wrong on
platforms where the sizeof a pointer is larger than the sizeof an int.  See
the gnu coding standards, which mentions this.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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