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: Michael Matz <matz at suse dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>,gcc-patches at gcc dot gnu dot org, Marcus Meissner <meissner at suse dot de>
- Date: Mon, 2 May 2005 07:13:44 +0200 (CEST)
- Subject: Re: [C++ patch] accept __null as sentinel
- References: <Pine.LNX.4.58.0504292128010.20714@wotan.suse.de><Pine.LNX.4.61.0504292019530.9310@digraph.polyomino.org.uk><Pine.LNX.4.58.0504292324520.20714@wotan.suse.de> <m31x8sevg2.fsf@uniton.integrable-solutions.net>
Hi,
On Sat, 30 Apr 2005, Gabriel Dos Reis wrote:
> | > I also thought that stylistically C++ programmers would generally be
> | > more careful about including casts and would expect to need them here.
> |
> | You couldn't be more wrong I fear. The casual C++ programmer (and for
> | that matter C programmer) knows absolutely nothing about the difference of
> | a null pointer constant and a null pointer. And even less of them know
> | that NULL in C++ is only a null pointer constant.
>
> The issue is so that it triggered an extension (for C++0x) to consider
> nullptr
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1488.pdf
>
> At least that gives an idea about what (some) C++ programmers think
> the null pointer is written.
Interesting. I like it. I've a comment about on thing in it:
We must investigate whether NULL is used so frequently as a varadic
argument that we should consider defining a representation for nullptr
to allow such use.
My comment would be, that it's _very_ common for some classes of
interface. Marcus mentioned some of the libraries which expose at least
some functions with a variadic argument list consisting of pointers (often
e.g. name-value pairs, where the last one is marked by a NULL "name"). At
the same time I believe it would be enough, if the bit representation of
such use of 'nullptr' would be that of a (void*)0.
Ciao,
Michael.