On 02.03.2014 03:15, Philip Martin wrote:
> Branko Čibej <brane_at_wandisco.com> writes:
>> However, the 'main' function is explicitly defined to have exactly two
>> int main(void); // or int main(); in C++
>> int main(int argc, char *argv);
>> The distinction is unimportant as far as the purpose of he configure
>> test is concerned; but a pedantic compiler may warn, or even refuse to
>> accept, the form you use in the test.
> I have no problem with your change but I don't believe a compiler would
> reject 'int main()'. The standard explicitly allows declarations
> "equivalent" to the two declarations you give and I believe 'int main()'
> qualifies, particularly since some of the examples in the standard use
> 'int main()'.
The standard allows the compiler to accept other, implementation-defined
signatures, but it does not require it to accept them. That's not the
same as allowing equivalent declarations. A compiler is perfectly free
to raise an error if it sees main defined in anything except the two
forms explicitly mentioned in the standard.
Granted, it's not very likely that you'll find such a compiler; but
given the purpose of this test, it's better not to confuse the outcome
by using slightly non-standard constructs in it.
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
Received on 2014-03-02 03:42:12 CET