[CMake] several questions about cmake

Mark Roden mmroden at gmail.com
Fri Aug 27 11:45:09 EDT 2010


Hi Jed,

I don't want portable code.  I want the socket++ code that I
originally got from someone else to compile as intended on the various
platforms they support.  They put a void as a return type; that void
as a return type is compiling just fine on vs2008, which according to
that page, is perfectly legal behavior for that compiler.  This code
is part of a config file, so I figure that if the test fails, then
that means that socket++ was intended to run with extern 'c' wrapping
around various functions.

Are they correct?  I don't know.  Does it work for me?  Yes.

You are right that C++ is not a strict superset of C ( at least
according to http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B;
I'm a big fan of sources), but in this instance, it looks like some
compiler vendors were under that impression. I can only assume that
the original authors of the library were as well, and wrote their code
accordingly.  I don't have the expertise in their domain (networking)
to be provide useful debugging.

Thanks,
Mark

On Fri, Aug 27, 2010 at 8:30 AM, Jed Brown <jed at 59a2.org> wrote:
> 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