bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoid some warnings in tests


From: Ben Pfaff
Subject: Re: avoid some warnings in tests
Date: Sat, 24 Oct 2009 07:54:31 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Bruno Haible <address@hidden> writes:

> According to my understanding of C99,
>   - foo() as a function _definition_ defines a function with 0 arguments,
>     not with varargs. (Things are different for a function _declaration_
>     without a body.)

Yes.

>   - There is no reason for GCC to warn about foo().

Probably Eric is using -Wstrict-prototypes:

    `-Wstrict-prototypes (C and Objective-C only)'
         Warn if a function is declared or defined without specifying the
         argument types.  (An old-style function definition is permitted
         without a warning if preceded by a declaration which specifies the
         argument types.)

-Wstrict-prototypes is useful for finding foo()-style
declarations (especially in header files) to remind the
programmer to change them to foo(void) prototypes, so that
callers cannot inadvertently invoke them with one or more
arguments.

-Wstrict-prototypes is less useful for the main function, since
it is rarely invoked directly by other program code.
-- 
Ben Pfaff 
http://benpfaff.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]