Warning for unadorned 0 in varargs lists?
Joseph S. Myers
jsm@polyomino.org.uk
Mon Aug 23 16:08:00 GMT 2004
On Mon, 23 Aug 2004, Kaveh R. Ghazi wrote:
> > In addition, the sentinel is the first variadic argument with the
> > right value, and subsequent arguments beyond
> > sentinel_position_from_end of them would be warned for unless
> > -Wno-format-extra-args.
>
> I'm not sure this is desirable, suppose a function similar to execle
> accepted a NULL env pointer? Why require the user to specify extra
> flags? (I don't feel strongly about this one, it could certainly be
> implemented as a refinement also.)
It's not a problem for it to accept a NULL env pointer, that's still
exactly one argument after the sentinel. The point being that if you have
two arguments after the sentinel (say), only the first would be considered
and the subsequent ones would be ignored. Likewise, with execl, any
arguments after the sentinel are ignored.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
More information about the Gcc
mailing list