[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Clarification about log message in commit 48df89e10e
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] Clarification about log message in commit 48df89e10e |
Date: |
Sat, 17 Apr 2021 20:04:44 +0200 |
User-agent: |
Mutt/2.0.6+151 (0684a051) vl-132933 (2021-04-16) |
On 2021-04-17 19:12:38 +0300, Stefanos wrote:
> The reason I asked this question is because I was reading the C standard and
> found the following parts at 5.1.2.2.1 [1] and at 6.7.5.3/14 [2]:
[...]
> 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.
>
>
> In other words, all the tests that use `int main()` are open to accept
> any number of parameters, correct?
"int main ()" defines no prototype, meaning that the compiler cannot
check whether the code is correct or not. This is old K&R C and should
no longer be used in general. AFAIK, for a function definition, if you
do not declare parameters in the K&R way, this is equivalent to void.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)