This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc.dg/c90-impl-decl-1.c
- To: Zack Weinberg <zack at wolery dot cumb dot org>
- Subject: Re: gcc.dg/c90-impl-decl-1.c
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Sun, 30 Jul 2000 11:18:14 +0100 (BST)
- cc: Richard Henderson <rth at thief dot cygnus dot com>, gcc-bugs at gcc dot gnu dot org
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