bfin c++ problem
Thu Jul 21 12:17:00 GMT 2016
On Thu, Jul 21, 2016 at 12:40:43PM +0100, Jonathan Wakely wrote:
> 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.
If you could provide some evidence, that would be helpful.
I think it's wrong what you are saying.
Where is the concept of "same type" defined?
There is defined the "equivalence of types", for the purpose of
overloading, and as the Standard defines, main can not be overloaded,
and can not be called.
does not list "int main(void)" as a possibility.
Sure, the C++ standard is, like almost all standards, not a precise
definition, but has to be interpreted. But the interpretation, that
"main(void)" is not required, seems common.
> 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.
Sure, it solves the problem: just get rid off the "void", problem
More information about the Gcc-help