[CMake] Compile project as C++ if MSVC

Mateusz Łoskot mateusz at loskot.net
Fri Dec 23 07:30:11 EST 2011


2011/12/23 Pau Garcia i Quiles <pgquiles at elpauer.org>:
> 2011/12/23 Mateusz Łoskot <mateusz at loskot.net>:
>
>>> For now, the usual work-around is to build the project as C++.
>>
>> If a certain feature from C99 is not supported by Visual C++,
>> how it is supposed to be workaround?
>
> Many C99 features were already supported by standard C++ and/or Visual
> C++-specific features: mixing declarations and code, snprintf, inline
> functions, more data types, etc

No.

All the features you listed above are C++ standard features, including
snprintf which is C++11 feature introduced as part of C99 compatibility.

There are *no* C99 features available in Visual C++, other than those
defined by C++11.
However, there are Microsoft-specific features in Visual C++ which
only look & feel like C99
but they are not claimed or documented as they supposed to be considered as C99.
Thus, _snprintf (not snprintf, in pre-Visual Studio 11) is
Microsoft-specific feature, *not* C99.
In Visual Studio 11 it is snprintf, which is C++11 feature.

Regarding C language, there is *no* support of plain/core C99,
other than that from C++11 and future revisions.
It has been clearly stated by Microsoft many times.
It is just people seem to be confused or just don't want to understand
it (and then complain).

[1] http://connect.microsoft.com/VisualStudio/feedback/details/531634/support-iso-c99-standard

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list