#define QUOTEME_(x) #x
#define QUOTEME(x) QUOTEME_(x)
#define VERSION(x) #x"="QUOTEME_(x)
#ifdef _MSC_VER
#pragma message( "Version: "QUOTEME(_MSC_VER) )
#pragma message( "Version: "VERSION(_MSC_VER) )
#elif __POCC__
#pragma message( "Version: "QUOTEME(__POCC__) )
#pragma message( "Version: "VERSION(__POCC__) )
#elif __WATCOMC__
#pragma message( "Version: "QUOTEME(__WATCOMC__) )
#pragma message( "Version: "VERSION(__WATCOMC__) )
#elif __DMC__
#pragma message( "Version: "QUOTEME(__DMC__) )
#pragma message( "Version: "VERSION(__DMC__) )
#endif
C:\code\msvc9>cl.exe -c MacroTest.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
MacroTest.c
Version: 1500
Version: _MSC_VER=1500
C:\code\PellesC\test-forum>pocc.exe MacroTest.c
Version:
MacroTest.c(10): warning #2001: Syntax error: expected ')' but found 'QUOTEME'.
Version:
MacroTest.c(11): warning #2001: Syntax error: expected ')' but found 'VERSION'.
warning #2024: [ISO] Empty input file.
C:\code\OWatcom>wcc386.exe MacroTest.c
Open Watcom C32 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
MacroTest.c(6) :
Version: 1290
Version: __WATCOMC__=1290
MacroTest.c: 24 lines, 0 warnings, 0 errors
Code size: 0
c:\code\DigitalMars>dmc.exe -c MacroTest.c
Version: 0x852
Version: __DMC__=0x852
C:\code\msvc71>cl.exe -c MacroTest.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
MacroTest.c
Version: 1310
Version: _MSC_VER=1310