This is the mail archive of the gcc-patches@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: [C++ patch] accept __null as sentinel


On Fri, 29 Apr 2005, Michael Matz wrote:

> While strictly speaking this is indeed not correct (and hence PR19542 was
> closed as invalid) we invented the special __null node in C++ (to which
> NULL is expanded) exactly to make it possible to write uncasted NULL and
> be sure that its size is exactly as large as a pointer type.  So I

I thought the purpose of __null was actually to allow warnings when NULL 
was used in an integer context (e.g. for "int x = __null;"), not to make 
writing uncast NULL valid in varargs (in programs for which only 
portability to G++ matters).  I also thought that stylistically C++ 
programmers would generally be more careful about including casts and 
would expect to need them here.

On that basis, I think a -Wno-format-null-sentinel or similar option to 
allow this warning to be disabled for __null would be better than removing 
this warning from -Wall.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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