[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1573106 - /subversion/trunk/build/ac-macros/compiler.m4

From: Branko Čibej <brane_at_wandisco.com>
Date: Sun, 02 Mar 2014 03:41:31 +0100

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
>> forms:
>>
>> int main(void); // or int main(); in C++
>>
>> and
>>
>> 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.

-- Brane

-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane_at_wandisco.com
Received on 2014-03-02 03:42:12 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.