From: Vladimir Grigoriev on
In the C++standard there is the following text (3.6.1.2)
"An implementation shall not predefine the main function. This function
shall not be overloaded. It shall

have a return type of type int, but otherwise its type is
implementation-defined."



What does mean "otherwise"? Does it mean that the main may return void?



Vladimir Grigoriev


From: Igor Tandetnik on
Vladimir Grigoriev wrote:
> In the C++standard there is the following text (3.6.1.2)
> "An implementation shall not predefine the main function. This function
> shall not be overloaded. It shall
>
> have a return type of type int, but otherwise its type is
> implementation-defined."
>
>
>
> What does mean "otherwise"? Does it mean that the main may return void?

"Its" here means "the function's". The type of the function comprises its return type and the number and types of its parameters. So, the return type should be int, but the number and types of parameters are implementation-defined.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
From: Vladimir Grigoriev on
Thanks, Igor. I could not understand this part of the phrase.

Vladimir Grigoriev

"Igor Tandetnik" <itandetnik(a)mvps.org> wrote in message
news:e6MOjIlrKHA.5936(a)TK2MSFTNGP04.phx.gbl...
Vladimir Grigoriev wrote:
> In the C++standard there is the following text (3.6.1.2)
> "An implementation shall not predefine the main function. This function
> shall not be overloaded. It shall
>
> have a return type of type int, but otherwise its type is
> implementation-defined."
>
>
>
> What does mean "otherwise"? Does it mean that the main may return void?

"Its" here means "the function's". The type of the function comprises its
return type and the number and types of its parameters. So, the return type
should be int, but the number and types of parameters are
implementation-defined.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily
a good idea. It is hard to be sure where they are going to land, and it
could be dangerous sitting under them as they fly overhead. -- RFC 1925


From: Ben Voigt [C++ MVP] on
> "Its" here means "the function's". The type of the function comprises
> its return type and the number and types of its parameters. So, the
> return type should be int, but the number and types of parameters are
> implementation-defined.

I think the type of the function would also include calling convention.


From: Stephan T. Lavavej [MSFT] on
The Standard doesn't recognize the existence of calling conventions (and
rightfully so, as calling conventions plural are the bane of humanity).

In the (obnoxiously calling-convention-infested) real world, calling
conventions are part of function types and function pointer types. This is
why TR1 <functional> didn't work with non-default calling conventions until
VC10, when I took several days to properly overload and specialize our
machinery for each possible calling convention on each platform and
configuration.

STL

"Ben Voigt [C++ MVP]" <bvoigt(a)newsgroup.nospam> wrote in message
news:uuONN8BsKHA.3536(a)TK2MSFTNGP06.phx.gbl...
>> "Its" here means "the function's". The type of the function comprises
>> its return type and the number and types of its parameters. So, the
>> return type should be int, but the number and types of parameters are
>> implementation-defined.
>
> I think the type of the function would also include calling convention.
>