[c++] warn if NULL is passed through varargs

Michael Matz matz@suse.de
Wed Oct 9 12:11:00 GMT 2002


Hi,

On 9 Oct 2002, Alexandre Oliva wrote:

> So GCC would be doing a favor to the user by recommending a type cast

Be careful with the favors you do to users.  They don't might like it ;-)

> to the intended pointer type in C, just like it currently does in C++
> (except in the varargs case, that the patch fixes).
>
> Which of these arguments do you disagree with?  Or, which
> counter-arguments can you bring into this debate?

Real world?  Which machine which is supported by gcc has a different
representation of different pointer types (in C please).  And on which
machine is the zero-bit pattern not the representation of (void*)0 (also
C)?  I'm not saying they don't exist, and I know the standard permits such
machines.  I'm just asking for a reality check.  If for 99% of users this
would warn about a reality-non-issue I think the warning is not justified,
sorry.  I mean, we can play die-hard standard only implementors (or at
least pedantic warners about non-standard constructs); the question is, if
this helps a big enough number of people, and does not distract a too big
number, and is not just to pet our ego.


Ciao,
Michael.



More information about the Gcc-patches mailing list