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?
* Joseph S. Myers:
> I'd suggest a refinement: that the variadic arguments before the sentinel
> should be required to have types interchangable with the type of the
> sentinel in va_arg. So for a sentinel of type void * they could have
> types pointer to void or to character types, or any pointer type unless
> -pedantic (as with format warnings for printf %p).
I don't think this can be enabled unconditionally. Is anybody
familiar with OpenWindows on 64 bit platforms? IIRC it's common to
mix 32 bit and 64 bit arguments *before* the sentinel. Eddie Kohler's
example is in this category, too.
(There's nothing wrong with such argument lists, as <stdarg.h> can
handle them, BTW.)