Warning for unadorned 0 in varargs lists?

Joe Buck Joe.Buck@synopsys.COM
Fri Aug 20 01:03:00 GMT 2004


On Thu, Aug 19, 2004 at 04:41:07PM -0700, Eddie Kohler wrote:
> > A warning would make sense if, rather than warning for all varargs
> > functions, the user only gets a warning for functions that definitely
> > expect pointers: execl, for example.  It might be better to do this 
> > with
> > something like the format-checking attributes supported for printf-like
> > functions: that is, an attribute that says a varargs function's 
> > variable
> > arguments are all pointers, or something like that.
> 
> This would generate the minimum number of false positives, but wouldn't 
> catch a bunch of errors, or errors on most user functions.  I'd be 
> happy even with a version of the warning that required me to write 
> "(int) 0" when I meant the integer zero (in varargs lists only).

But if the attribute approach were followed, the user can add her own
attributes to do checking for execl-like functions.  This is already
easily done for nonstandard printf-like functions.



More information about the Gcc mailing list