gcc.dg/c90-impl-decl-1.c
Joseph S. Myers
jsm28@cam.ac.uk
Sun Jul 30 03:22:00 GMT 2000
On Sat, 29 Jul 2000, Zack Weinberg wrote:
> > "Can" or "shall"? Unless "shall", I'd prefer this test removed,
> > since users really ought to include <string.h>.
>
> We can still complain about it with -Wall, but it isn't supposed to be
> a -pedantic complaint in C90 mode. (Since C90 doesn't say we SHALL
> NOT implicitly declare strcmp.)
To be precise:
Provided that a library function can be declared without reference
to any type defined in a header, it is also permissible to declare
the function, either explicitly or implictly, and use it without
including its associated header. If a function that accepts a
variable number of arguments is not declared (explicitly or by
including its associated header), the behavior is undefined.
Thus, the warning is nothing to do with -pedantic except in C99 mode,
since the usage is correct according to the 1990 standard (if
inadvisable). -Wall warnings here are desirable; -pedantic warnings if
the implicit declaration is wrong (e.g. for abort) are reasonable.
--
Joseph S. Myers
jsm28@cam.ac.uk
More information about the Gcc-bugs
mailing list