|
|
Jack Klein wrote:
>
> On the other hand, here's what the help for Visual Studio 2008 says at
> http://msdn2.microsoft.com/en-us/library/6wd819wh.aspx right now:
>
>
>
> The main function is not predefined by the compiler; rather, it must
> be supplied in the program text.
>
> <begin quote>
> The declaration syntax for main is:
>
> int main( );
>
> or, optionally:
>
> int main(int argc, char *argv[], char *envp[]);
> <end quote>
>
> The second example is legal as an extension in both C and C++, but
> they don't mention the completely standard two-argument version. And
> they don't mention that the three-argument form is an extension, and
> not necessarily portable.
>
> Following this is a section on using wmain() instead of main(), and
> commendably this is very clearly marked as "Microsoft Specific".
>
> After that, among other things, comes this:
>
> <begin quote>
> Alternately, the main and wmain functions can be declared as returning
> void (no return value). If you declare main or wmain as returning
> void, you cannot return an exit code to the parent process or
> operating system using a return statement; to return an exit code when
> main or wmain is declared as void, you must use the exit function.
> <end quote>
>
> And there is no disclaimer that defining "void main()" is undefined
> behavior in C prior to C99 (and MS does not conform, nor claims to
> conform to C99), and just plain ill-formed in C++.
>
> I think Microsoft does not bother to look at existing compatibility
> when defining extensions. A lot of the rest is just sloppiness on the
> part of their implementers and documentation producers, coupled with
> the fact that introducing portability and compatibility issues does
> not bother them.
>
> I don't know that they introduce compatibility issues deliberately as
> part of an evil plan, but I don't think they worry in the slightest if
> any issues that they do introduce make it difficult to port code
> developed with their tools on Windows to non-Windows platforms.
Yes, current C/C++ MSDN help sucks in many areas.
|
|