[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Clarification about log message in commit 48df89e10e
From: |
Stefanos |
Subject: |
Re: [Tinycc-devel] Clarification about log message in commit 48df89e10e |
Date: |
Sat, 17 Apr 2021 19:12:38 +0300 |
> If you restrict yourself to c89 that would match the requirement. The
> actual requirement is rather: "needs to be compilable with an old msvc".
> I don't know which exact version of msvc that is, but it's one that
> doesn't support designated initializers and some other c99 stuff.
> grischka uses such msvc.
Ah yes, I completely forgot about MSVC...
> No particular reason most probably (except in the case when specifically
> the standard mandated behaviour of 'int main()' is tested). If you prefer
> the void form for new tests use it. (please don't change existing tests
> except for good reasons)
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]:
The function called at program startup is named main. The implementation
declares no prototype for this function. It shall be defined with a return
type of int and with no parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names
may be used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or equivalent; 9) or in some other implementation-defined manner.
and
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?
Was this implemented intentionally or just happened?
Please advice.
Thank you very much.
[1] page 12
[2] page 119
C Standard http://www.open-std.org/JTC1/sc22/wg14/www/docs/n1256.pdf