[CMake] several questions about cmake

Jed Brown jed at 59A2.org
Fri Aug 27 11:30:32 EDT 2010


On Fri, 27 Aug 2010 08:10:49 -0700, Mark Roden <mmroden at gmail.com> wrote:
> And it turns out that it is valid C++ to have
> void main()
> 
> because it's valid C.
> 
> Source:
> http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/legality-of-void-main.html

You seem to have misread the link (which appears to falsely assert that
"otherwise its type is implementation-defined" is functionally different
from "some other implementation-defined manner").

The validity is implementation-defined, it is not standard C or C++.
And C++ is not a superset of C (far from it), so even if the C standard
did guaratee that returning void was supported (it doesn't), it would
not imply that C++ supports it.

If you want portable code, main must return int.

Jed


More information about the CMake mailing list