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: Warning for unadorned 0 in varargs lists?


 > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 > 
 > > I used to feel as you do, that since 0 works in practice we should
 > 
 > In practice it does _not_ work.
 > Andreas.

I should have qualified that.  It works in practice on some systems.
E.g. solaris defines NULL to 0L or 0 depending on whether we're in
LP64 mode or not.  So when you use solaris cc you get an int or long
zero not a pointer zero.

I don't know if 0L works on other LP64 ABIs, and I agree with you that
0 doesn't substitute for pointer zero and we should prefer NULL
because of that.

As I mentioned before, GCC headers override NULL to (void*)0 on all
systems.  So GCC can look for just pointer zero and warn if it doesn't
see it.

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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