This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning for unadorned 0 in varargs lists?
> My concern was about differentiating between 0 and NULL. If you care
> about what works in practise, you should warn about neither; if you
> care about pedantic standard compliance, you should warn for both.
> Falk
I used to feel as you do, that since 0 works in practice we should
silently accept it. But it costs the user nothing to switch to NULL
in their code and may in fact fix a bug where some 64-bit ABI doesn't
do padding for unadorned 0.
Forcing the user to write NULL instead of 0 even if in practice 0 may
be okay is just like e.g. requiring double parens around assignments
used as truth values.
If the user really wants integer zero, they can supply the third
argument `sentinel_value' with an int type.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu