[cfe-dev] Extra #defines for Windows SDK 6.0a/VS2008

Jesse Towner townerj at gmail.com
Fri Aug 6 07:29:45 PDT 2010


You could still identify the compiler if you check for __clang__ before
__GNUC__ or _MSC_VER.

#if defined(__clang__)
// ... clang specific
#elif defined(_MSC_VER)
// ... MSVC++ specific
#endif

#ifdef _MSC_VER
// ... clang and MSVC++ compatible stuff
#endif

This is how it's done for Intel C++, just substitute __ICL in for
__clang__.

On Fri, 2010-08-06 at 16:19 +0200, Bjorn Reese wrote:
> On 2010-08-06 15:45, David Chisnall wrote:
> > On 6 Aug 2010, at 14:21, Douglas Gregor wrote:
> >
> >> I wonder how much will break if we start defining _MSC_VER? Does anyone know how mingw deals with this?
> >
> > We already define the GCC version macros so that we can act as a drop-in replacement for GCC.  If we're aiming to act as a drop-in replacement for MSVC then it would make sense to define their version macros and treat any incompatibilities in MS-extensions mode as bugs, just as we treat incompatibilities with GCC in GNU C modes as bugs.
> 
> Defining _MSC_VER or __GNUC__ or any other macro that identifies another
> compiler is a problem because it makes it very difficult to handle
> differences or defects via predefined macros.
> 
> Many projects rely on this, e.g. boost, wxwidget, and indeed your own
> libcxx.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list