This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC/RFHelp: c-decl.c rewrite - almost but not quite


On Tue, 16 Mar 2004, Zack Weinberg wrote:

> C99 6.7.5.3p14:
> 
>     An identifier list declares only the identifiers of the parameters
>     of the function. An empty list in a function declarator that is
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     part of a definition of that function specifies that the function
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     has no parameters. The empty list in a function declarator that is
>     ^^^^^^^^^^^^^^^^^^
>     not part of a definition of that function specifies that no
>     information about the number or types of the parameters is
>     supplied.
> 
> I read this to indicate that *in a function definition* () is the same
> as (void), and should not be taken as an old-style definition.

Specifying that it has no parameters is not the same as giving it a
prototype type; it is simply contrasting with other empty lists that give
no information at all.  Any definition with an identifier list specifies
the parameters without giving a prototype type.  (6.9.1#7 says that a
definition *with a parameter type list* serves as a prototype for the rest
of that translation unit.)  We've been through this before in PR 6326.  
Only parameter type lists give functions a type with a prototype.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]