This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: bfin c++ problem
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Oliver Kullmann <o dot kullmann at swansea dot ac dot uk>
- Cc: Waldemar Brodkorb <wbx at openadk dot org>, gcc-help <gcc-help at gcc dot gnu dot org>, buildroot at buildroot dot org, Thomas Petazzoni <thomas dot petazzoni at free-electrons dot com>
- Date: Thu, 21 Jul 2016 12:40:43 +0100
- Subject: Re: bfin c++ problem
- Authentication-results: sourceware.org; auth=none
- References: <20160721000402.GR22524@waldemar-brodkorb.de> <20160721030504.GN4023@csltok.swansea.ac.uk> <CAH6eHdRNcLv9iT8dKN_zneVp2=P=yakUH=p8wq5dz5q2gNL-xQ@mail.gmail.com> <20160721111244.GO4023@csltok.swansea.ac.uk>
On 21 July 2016 at 12:12, Oliver Kullmann wrote:
> On Thu, Jul 21, 2016 at 11:26:42AM +0100, Jonathan Wakely wrote:
>> On 21 July 2016 at 04:05, Oliver Kullmann wrote:
>> > Hello,
>> >
>> > a C++ compiler is not required to recognise "main(void)":
>>
>> That's incorrect.
>>
>> Although I consider (void) parameter lists to be an abomination in
>> C++, "int main(void)" has exactly the same type as "int main()" which
>> is one of the types that all implementations must support.
>
> Where did you get this?
> The Standard Subsection 3.6.1 says
>
> All implementations shall allow both of the following definitions of
> main:
>
> int main()
> and
> int main(int argc char* argv[])
>
> That's it!
It's 2016 not 2011.
The Standard (i.e. C++14) specifies the *types* of main function that
all implementations support. int main() and int main(void) are the
same type.
In any case, additional implementation-defined forms have always been
allowed, and G++ allows int main(void), so telling the OP it isn't
correct isn't very helpful. That's not the cause of his error.