This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ patch] accept __null as sentinel
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Marcus Meissner <meissner at suse dot de>
- Date: Fri, 29 Apr 2005 20:24:50 +0000 (UTC)
- Subject: Re: [C++ patch] accept __null as sentinel
- References: <Pine.LNX.4.58.0504292128010.20714@wotan.suse.de>
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)