도전2022
Predefined Macros 본문
http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx
Predefined Macros
Names the predefined ANSI C and Microsoft C++ implementation macros.
The compiler recognizes predefined ANSI C macros and the Microsoft C++ implementation provides several more. These macros take no arguments and cannot be redefined. Some of the predefined macros listed below are defined with multiple values. See the following tables for more information.
Macro | Description |
---|---|
__DATE__ |
The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H. |
__FILE__ |
The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks. To ensure that the full path to the file is displayed, use /FC (Full Path of Source Code File in Diagnostics). You can create your own wide string version of __FILE__ as follows: |
__LINE__ |
The line number in the current source file. The line number is a decimal integer constant. It can be altered with a #line directive. |
__STDC__ |
Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za compiler option is given and you are not compiling C++ code; otherwise is undefined. |
__TIME__ |
The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss. |
__TIMESTAMP__ |
The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31. |
Macro | Description |
---|---|
_ATL_VER |
Defines the ATL version. |
_CHAR_UNSIGNED |
Default char type is unsigned. Defined when /J is specified. |
__CLR_VER |
Defines the version of the common language runtime used when the application was compiled. The value returned will be in the following format: Mmmbbbbb where, M is the major version of the runtime. mm is the minor version of the runtime. bbbbb is the build number. |
__cplusplus_cli |
Defined when compiling with /clr, /clr:pure, or /clr:safe. Value of __cplusplus_cli is 200406. __cplusplus_cli is in effect throughout the translation unit. |
__COUNTER__ |
Expands to an integer starting with 0 and incrementing by 1 every time it is used in a compiland. __COUNTER__ remembers its state when using precompiled headers. If the last __COUNTER__ value was 4 after building a precompiled header (PCH), it will start with 5 on each PCH use. __COUNTER__ lets you generate unique variable names. You can use token pasting with a prefix to make a unique name. For example: // pre_mac_counter.cpp #include <stdio.h> #define FUNC2(x,y) x##y #define FUNC1(x,y) FUNC2(x,y) #define FUNC(x) FUNC1(x,__COUNTER__) int FUNC(my_unique_prefix); int FUNC(my_unique_prefix); int main() { my_unique_prefix0 = 0; printf_s("\n%d",my_unique_prefix0); my_unique_prefix0++; printf_s("\n%d",my_unique_prefix0); } |
__cplusplus |
Defined for C++ programs only. |
_CPPLIB_VER |
Defined if you include any of the C++ Standard Library headers; reports which version of the Dinkumware header files are present. |
_CPPRTTI |
Defined for code compiled with /GR (Enable Run-Time Type Information). |
_CPPUNWIND |
Defined for code compiled with /GX (Enable Exception Handling). |
_DEBUG |
Defined when compiling with /LDd, /MDd, and /MTd. |
_DLL |
Defined when /MD or /MDd (Multithread DLL) is specified. |
__FUNCDNAME__ |
Valid only within a function and returns the decorated name of the enclosing function (as a string). __FUNCDNAME__ is not expanded if you use the /EP or /P compiler option. |
__FUNCSIG__ |
Valid only within a function and returns the signature of the enclosing function (as a string). __FUNCSIG__ is not expanded if you use the /EP or /P compiler option. On a 64-bit operating system, the calling convention is __cdecl by default. |
__FUNCTION__ |
Valid only within a function and returns the undecorated name of the enclosing function (as a string). __FUNCTION__ is not expanded if you use the /EP or /P compiler option. |
_INTEGRAL_MAX_BITS |
Reports the maximum size (in bits) for an integral type. |
_M_ALPHA |
Defined for DEC ALPHA platforms (no longer supported). |
_M_CEE |
Defined for a compilation that uses any form of /clr (/clr:oldSyntax, /clr:safe, for example). |
_M_CEE_PURE |
Defined for a compilation that uses /clr:pure. |
_M_CEE_SAFE |
Defined for a compilation that uses /clr:safe. |
_M_IX86 |
Defined for x86 processors. See Values for _M_IX86 for more details. |
_M_IA64 |
Defined for Itanium Processor Family 64-bit processors. |
_M_IX86_FP |
Expands to a value indicating which /arch compiler option was used:
|
_M_MPPC |
Defined for Power Macintosh platforms (no longer supported). |
_M_MRX000 |
Defined for MIPS platforms (no longer supported). |
_M_PPC |
Defined for PowerPC platforms (no longer supported). |
_M_X64 |
Defined for x64 processors. |
_MANAGED |
Defined to be 1 when /clr is specified. |
_MFC_VER |
Defines the MFC version. For example, 0x0700 represents MFC version 7. |
_MSC_EXTENSIONS |
This macro is defined when compiling with the /Ze compiler option (the default). Its value, when defined, is 1. |
_MSC_VER |
Reports the major and minor versions of the compiler. For example, 1310 for Microsoft Visual C++ .NET 2003. 1310 represents version 13 and a 1.0 point release. The Visual C++ 2005 compiler version is 1400. Type cl /? at the command line to see the major and minor versions of your compiler along with the build number. |
__MSVC_RUNTIME_CHECKS |
Defined when one of the /RTC compiler options is specified. |
_MT |
Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified. |
_NATIVE_WCHAR_T_DEFINED |
Defined when /Zc:wchar_t is used. |
_OPENMP |
Defined when compiling with /openmp, returns an integer representing the date of the OpenMP specification implemented by Visual C++. |
_VC_NODEFAULTLIB |
Defined when /Zl is used; see /Zl (Omit Default Library Name) for more information. |
_WCHAR_T_DEFINED |
Defined when /Zc:wchar_t is used or if wchar_t is defined in a system header file included in your project. |
_WIN32 |
Defined for applications for Win32 and Win64. Always defined. |
_WIN64 |
Defined for applications for Win64. |
_Wp64 |
Defined when specifying /Wp64. |
As shown in following table, the compiler generates a value for the preprocessor identifiers that reflect the processor option specified.
Option in Development Environment | Command-Line Option | Resulting Value |
---|---|---|
Blend |
/GB |
_M_IX86 = 600 (Default. Future compilers will emit a different value to reflect the dominant processor.) |
Pentium |
/G5 |
_M_IX86 = 500 |
Pentium Pro, Pentium II, and Pentium III |
/G6 |
_M_IX86 = 600 |
80386 |
/G3 |
_M_IX86 = 300 |
80486 |
/G4 |
_M_IX86 = 400 |
A sample function that uses ANSI-Compliant Predefined Preprocessor Macros:
bool CPreprocessingDlg::UseMicrosoftSpecificPredefinedMacros(void)
{
// Using Microsoft-Specific Predefined Preprocessor Macros
// Ref: http://msdn.microsoft.com/en-us/library/b0084kay(VS.80).aspx
TCHAR buffer[MAX_PATH];
CString m_strOutput;
m_strOutput += "\r\n\r\n";
m_strOutput += "-- Microsoft-Specific Predefined Macros --";
// _ATL_VER - Defines the ATL version.
m_strOutput += "\r\n";
swprintf_s(buffer, MAX_PATH, TEXT("ATL Version: 0x%0.4X"), _ATL_VER);
m_strOutput += buffer;
// _CHAR_UNSIGNED - Default char type is unsigned. Defined when /J is specified.
m_strOutput += "\r\n";
m_strOutput += "Default char Type Is unsigned [_CHAR_UNSIGNED]: ";
#ifdef _CHAR_UNSIGNED
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _CHAR_UNSIGNED);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// __CLR_VER - Defines the version of the common language runtime used
// when the application was compiled. The value returned will be in
// the following format: Mmmbbbbb
// where,
// M is the major version of the runtime.
// mm is the minor version of the runtime.
// bbbbb is the build number.
m_strOutput += "\r\n";
m_strOutput += "Common Language Runtime Version [__CLR_VER]: ";
#ifdef __CLR_VER
swprintf_s(buffer, MAX_PATH, TEXT("%s"), __CLR_VER);
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// __cplusplus_cli - Defined when compiling with /clr, /clr:pure, or /clr:safe.
// Value of __cplusplus_cli is 200406.
// __cplusplus_cli is in effect throughout the translation unit.
m_strOutput += "\r\n";
m_strOutput += "__cplusplus_cli: ";
#ifdef __cplusplus_cli
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), __cplusplus_cli);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// __cplusplus - Defined for C++ programs only.
m_strOutput += "\r\n";
m_strOutput += "C++ Program [__cplusplus]: ";
#ifdef __cplusplus
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), __cplusplus);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _CPPLIB_VER - Defined if you include any of the C++ Standard Library headers.
// Reports which version of the Dinkumware header files are present.
m_strOutput += "\r\n";
m_strOutput += "C++ Standard Library Header Version [_CPPLIB_VER]: ";
#ifdef _CPPLIB_VER
swprintf_s(buffer, MAX_PATH, TEXT("%s"), _CPPLIB_VER);
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _CPPRTTI - Defined for code compiled with /GR (Enable Run-Time Type Information)
m_strOutput += "\r\n";
m_strOutput += "Enable Run-Time Type Information [_CPPRTTI]: ";
#ifdef _CPPRTTI
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _CPPRTTI);
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _CPPUNWIND - Defined for code compiled with /GX (Enable Exception Handling).
m_strOutput += "\r\n";
m_strOutput += "Enable Exception Handling [_CPPUNWIND]: ";
#ifdef _CPPUNWIND
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _CPPUNWIND);
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _DEBUG - Defined when compiling with /LDd, /MDd, and /MTd.
m_strOutput += "\r\n";
m_strOutput += "Debug Mode [_DEBUG]: ";
#ifdef _DEBUG
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _DEBUG);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _DLL - Defined when /MD or /MDd (Multithread DLL) is specified.
m_strOutput += "\r\n";
m_strOutput += "Multithread DLL [_DLL]: ";
#ifdef _DLL
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _DLL);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// __FUNCDNAME__ - Valid only within a function and returns the decorated
// name of the enclosing function (as a string). __FUNCDNAME__ is not
// expanded if you use the /EP or /P compiler option.
m_strOutput += "\r\n";
m_strOutput += "Function name (decorated) [__FUNCDNAME__]: ";
#ifdef __FUNCDNAME__
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT(__FUNCDNAME__));
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// __FUNCSIG__ - Valid only within a function and returns the signature of the
// enclosing function (as a string). __FUNCSIG__ is not expanded if you use the
// /EP or /P compiler option.
m_strOutput += "\r\n";
m_strOutput += "Function signature [__FUNCSIG__]: ";
#ifdef __FUNCSIG__
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT(__FUNCSIG__));
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// __FUNCTION__ - Valid only within a function and returns the undecorated name of the enclosing
// function (as a string). __FUNCTION__ is not expanded if you use the /EP or /P
// compiler option.
m_strOutput += "\r\n";
m_strOutput += "Function name [__FUNCTION__]: ";
#ifdef __FUNCTION__
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT(__FUNCTION__));
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _INTEGRAL_MAX_BITS - Reports the maximum size (in bits) for an integral type.
m_strOutput += "\r\n";
m_strOutput += "Integral type maximum size (in bits) [_INTEGRAL_MAX_BITS]: ";
#ifdef _INTEGRAL_MAX_BITS
swprintf_s(buffer, MAX_PATH, TEXT("%d"), _INTEGRAL_MAX_BITS);
#else
swprintf_s(buffer, MAX_PATH, TEXT("Undefined"));
#endif
m_strOutput += buffer;
// _M_ALPHA - Defined for DEC ALPHA platforms. It is defined as 1 by the ALPHA compiler, and
// it is not defined if another compiler is used.
m_strOutput += "\r\n";
m_strOutput += "DEC ALPHA Platform [_M_ALPHA]: ";
#ifdef _M_ALPHA
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_ALPHA);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _M_CEE - Defined for a compilation that uses any form of /clr (/clr:oldSyntax, /clr:safe,
// for example).
m_strOutput += "\r\n";
m_strOutput += "Common Language Runtime Compilation [_M_CEE]: ";
#ifdef _M_CEE
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_CEE);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _M_CEE_PURE - Defined for a compilation that uses /clr:pure.
m_strOutput += "\r\n";
m_strOutput += "Common Language Runtime Pure Compilation [_M_CEE_PURE]: ";
#ifdef _M_CEE_PURE
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_CEE_PURE);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _M_CEE_SAFE - Defined for a compilation that uses /clr:safe.
m_strOutput += "\r\n";
m_strOutput += "Common Language Runtime Safe Compilation [_M_CEE_SAFE]: ";
#ifdef _M_CEE_SAFE
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_CEE_SAFE);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _M_IX86 - Defined for x86 processors. See Values for _M_IX86 for more details.
// Blend: /GB: _M_IX86 = 600 (Default. Future compilers will emit a different value to reflect the dominant processor.)
// Pentium: /G5: _M_IX86 = 500
// Pentium Pro, Pentium II, and Pentium III: /G6: _M_IX86 = 600
// 80386: /G3: _M_IX86 = 300
// 80486: /G4: _M_IX86 = 400
m_strOutput += "\r\n";
m_strOutput += "Minimum CPU Architecture [_M_IX86]: ";
#ifdef _M_IX86
if (600 == _M_IX86)
swprintf_s(buffer, MAX_PATH, TEXT("%d - Blend (/GB) or Pentium Pro, Pentium II, Pentium III (/G6)"), _M_IX86);
else if (500 == _M_IX86)
swprintf_s(buffer, MAX_PATH, TEXT("%d - Pentium (/G5)"), _M_IX86);
else if (300 == _M_IX86)
swprintf_s(buffer, MAX_PATH, TEXT("%d - 80386 (/G3)"), _M_IX86);
else if (400 == _M_IX86)
swprintf_s(buffer, MAX_PATH, TEXT("%d - 80486 (/G4)"), _M_IX86);
else
swprintf_s(buffer, MAX_PATH, TEXT("%d - Unknown"), _M_IX86);
#else
swprintf_s(buffer, MAX_PATH, TEXT("Undefined"));
#endif
m_strOutput += buffer;
// _M_IA64 - Defined for Itanium Processor Family 64-bit processors.
m_strOutput += "\r\n";
m_strOutput += "Itanium Processor Family 64-bit [_M_IA64]: ";
#ifdef _M_IA64
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_IA64);
#else
swprintf_s(buffer, MAX_PATH, TEXT("NO"));
#endif
m_strOutput += buffer;
// _M_IX86_FP - Expands to a value indicating which /arch compiler option was used:
// 0 if /arch was not used.
// 1 if /arch:SSE was used.
// 2 if /arch:SSE2 was used.
m_strOutput += "\r\n";
m_strOutput += "Minimum CPU Architecture [_M_IX86_FP]: ";
#ifdef _M_IX86_FP
if (0 == _M_IX86_FP)
swprintf_s(buffer, MAX_PATH, TEXT("%d - %s"), _M_IX86_FP, TEXT("NO Streaming SIMD Extensions"));
else if (1 == _M_IX86_FP)
swprintf_s(buffer, MAX_PATH, TEXT("%d - %s"), _M_IX86_FP, TEXT("Streaming SIMD Extensions (/arch:SSE)"));
else if (2 == _M_IX86_FP)
swprintf_s(buffer, MAX_PATH, TEXT("%d - %s"), _M_IX86_FP, TEXT("Streaming SIMD Extensions 2 (/arch:SSE2)"));
else
swprintf_s(buffer, MAX_PATH, TEXT("%d - %s"), _M_IX86_FP, TEXT("UNKNOWN"));
#else
swprintf_s(buffer, MAX_PATH, TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// Defined for Power Macintosh platforms (no longer supported).
m_strOutput += "\r\n";
m_strOutput += "Power Macintosh Platform [_M_MPPC]: ";
#ifdef _M_MPPC
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_MPPC);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// Defined for MIPS platforms (no longer supported).
m_strOutput += "\r\n";
m_strOutput += "MIPS Platform (_M_MRX000): ";
#ifdef _M_MRX000
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_MRX000);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// Defined for PowerPC platforms (no longer supported).
m_strOutput += "\r\n";
m_strOutput += "PowerPC Platform [_M_PPC]: ";
#ifdef _M_PPC
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_PPC);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// Defined for x64 processors.
m_strOutput += "\r\n";
m_strOutput += "x64 Platform [_M_X64]: ";
#ifdef _M_X64
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _M_X64);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _MANAGED = Defined to be 1 when /clr is specified.
m_strOutput += "\r\n";
m_strOutput += "Managed Code [_MANAGED]: ";
#ifdef _MANAGED
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _MANAGED);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _MFC_VER - Defines the MFC version. For example, 0x0700 represents MFC version 7.
m_strOutput += "\r\n";
m_strOutput += "MFC Version [_MFC_VER]: ";
#ifdef _MFC_VER
swprintf_s(buffer, MAX_PATH, TEXT("0x%0.4X"), _MFC_VER);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _MSC_EXTENSIONS - Defined when compiling with the /Ze compiler option (the default).
// Its value, when defined, is 1.
m_strOutput += "\r\n";
m_strOutput += "Microsoft Language Extensions [_MSC_EXTENSIONS]: ";
#ifdef _MSC_EXTENSIONS
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("ENABLED"), _MSC_EXTENSIONS);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("DISABLED"));
#endif
m_strOutput += buffer;
// _MSC_VER - Reports the major and minor versions of the compiler.
// For example, 1310 for Microsoft Visual C++ .NET 2003.
// 1310 represents version 13 and a 1.0 point release.
// The current compiler version is 1400.
m_strOutput += "\r\n";
m_strOutput += "Microsoft Compiler Version (_MSC_VER): ";
#ifdef _MSC_VER
swprintf_s(buffer, MAX_PATH, TEXT("%d"), _MSC_VER);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// __MSVC_RUNTIME_CHECKS - Defined when one of the /RTC compiler options is specified.
m_strOutput += "\r\n";
m_strOutput += "Run-Time Error Checks (__MSVC_RUNTIME_CHECKS): ";
#ifdef __MSVC_RUNTIME_CHECKS
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("ENABLED"), __MSVC_RUNTIME_CHECKS);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("DISABLED"));
#endif
m_strOutput += buffer;
// Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified.
m_strOutput += "\r\n";
m_strOutput += "Multithreaded (_MT): ";
#ifdef _MT
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _MT);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _NATIVE_WCHAR_T_DEFINED - Defined when /Zc:wchar_t is used.
m_strOutput += "\r\n";
m_strOutput += "wchar_t Is Native Type (_NATIVE_WCHAR_T_DEFINED): ";
#ifdef _NATIVE_WCHAR_T_DEFINED
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _NATIVE_WCHAR_T_DEFINED);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _OPENMP - Defined when compiling with /openmp, returns an integer representing the date of
// the OpenMP specification implemented by Visual C++.
// _OPENMP_dir.cpp
// compile with: /openmp
// #include <stdio.h>
// int main() { printf("%d\n", _OPENMP); }sdOutput200203
m_strOutput += "\r\n";
m_strOutput += "OpenMP Specification Date (_OPENMP): ";
#ifdef _OPENMP
swprintf_s(buffer, MAX_PATH, TEXT("%d"), _OPENMP);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("UNDEFINED"));
#endif
m_strOutput += buffer;
// _VC_NODEFAULTLIB - Defined when /Zl is used; see /Zl (Omit Default Library Name) for more information.
m_strOutput += "\r\n";
m_strOutput += "Omit Default Library Name (_VC_NODEFAULTLIB): ";
#ifdef _VC_NODEFAULTLIB
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _VC_NODEFAULTLIB);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _WCHAR_T_DEFINED - Defined when /Zc:wchar_t is used or if wchar_t is defined in a system header
// file included in your project.
m_strOutput += "\r\n";
m_strOutput += "wchar_t Is Native Type (_WCHAR_T_DEFINED): ";
#ifdef _WCHAR_T_DEFINED
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _WCHAR_T_DEFINED);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// _WIN32 - Defined for applications for Win32 and Win64. Always defined.
m_strOutput += "\r\n";
m_strOutput += "Windows 32-bit (_WIN32): ";
#ifdef _WIN32
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _WIN32);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// Defined for applications for Win64.
m_strOutput += "\r\n";
m_strOutput += "Windows 64-bit (_WIN64): ";
#ifdef _WIN64
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _WIN64);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
// Defined when specifying /Wp64.
m_strOutput += "\r\n";
m_strOutput += "Detect 64-Bit Portability Issues (_Wp64): ";
#ifdef _Wp64
swprintf_s(buffer, MAX_PATH, TEXT("%s (%d)"), TEXT("YES"), _Wp64);
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
return false;
}
When the function finishes m_strOutput contains a string looking something like this:
-- Microsoft-Specific Predefined Macros --
ATL Version: 0x0800
Default char Type Is unsigned [_CHAR_UNSIGNED]: NO
Common Language Runtime Version [__CLR_VER]: UNDEFINED
__cplusplus_cli: NO
C++ Program [__cplusplus]: YES (199711)
C++ Standard Library Header Version [_CPPLIB_VER]: UNDEFINED
Enable Run-Time Type Information [_CPPRTTI]: YES (1)
Enable Exception Handling [_CPPUNWIND]: YES (1)
Debug Mode [_DEBUG]: YES (1)
Multithread DLL [_DLL]: NO
Function name (decorated) [__FUNCDNAME__]: ?UseMicrosoftSpecificPredefinedMacros@CPreprocessingDlg@@AAE_NXZ
Function signature [__FUNCSIG__]: bool __thiscall CPreprocessingDlg::UseMicrosoftSpecificPredefinedMacros(void)
Function name [__FUNCTION__]: CPreprocessingDlg::UseMicrosoftSpecificPredefinedMacros
Integral type maximum size (in bits) [_INTEGRAL_MAX_BITS]: 64
DEC ALPHA Platform [_M_ALPHA]: NO
Common Language Runtime Compilation [_M_CEE]: NO
Common Language Runtime Pure Compilation [_M_CEE_PURE]: NO
Common Language Runtime Safe Compilation [_M_CEE_SAFE]: NO
Minimum CPU Architecture [_M_IX86]: 600 - Blend (/GB) or Pentium Pro, Pentium II, Pentium III (/G6)
Itanium Processor Family 64-bit [_M_IA64]: NO
Minimum CPU Architecture [_M_IX86_FP]: 0 - NO Streaming SIMD Extensions
Power Macintosh Platform [_M_MPPC]: NO
MIPS Platform (_M_MRX000): NO
PowerPC Platform [_M_PPC]: NO
x64 Platform [_M_X64]: NO
Managed Code [_MANAGED]: NO
MFC Version [_MFC_VER]: 0x0800
Microsoft Language Extensions [_MSC_EXTENSIONS]: ENABLED (1)
Microsoft Compiler Version (_MSC_VER): 1400
Run-Time Error Checks (__MSVC_RUNTIME_CHECKS): ENABLED (1)
Multithreaded (_MT): YES (1)
wchar_t Is Native Type (_NATIVE_WCHAR_T_DEFINED): YES (1)
OpenMP Specification Date (_OPENMP): UNDEFINED
Omit Default Library Name (_VC_NODEFAULTLIB): NO
wchar_t Is Native Type (_WCHAR_T_DEFINED): YES (1)
Windows 32-bit (_WIN32): YES (1)
Windows 64-bit (_WIN64): NO
Detect 64-Bit Portability Issues (_Wp64): YES (1)
- 11/4/2009
- ddaS-edEn
A sample function that uses ANSI-Compliant Predefined Preprocessor Macros:
bool CPreprocessingDlg::UseANSICompliantPredefinedMacros(void)
{
// Using ANSI-Compliant Predefined Preprocessor Macros
TCHAR buffer[MAX_PATH];
CString m_strOutput;
m_strOutput += "-- ANSI-Compliant Predefined Macros --";
m_strOutput += "\r\n";
m_strOutput += "SOURCE FILE [__FILE__]:";
m_strOutput += __FILE__;
m_strOutput += "\r\n";
m_strOutput += "MODIFIED [__TIMESTAMP__]:";
m_strOutput += __TIMESTAMP__;
m_strOutput += "\r\n";
m_strOutput += "COMPILED [__DATE__]:";
m_strOutput += __DATE__;
m_strOutput += " at ";
m_strOutput += __TIME__;
m_strOutput += "\r\n";
m_strOutput += "This is line number [__LINE__]:";
swprintf_s(buffer, MAX_PATH, TEXT("%d"), __LINE__);
m_strOutput += buffer;
m_strOutput += "\r\n";
m_strOutput += "ANSI C/C++ Standard Conformance [__STDC__]:";
#ifdef __STDC__
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("YES"));
#else
swprintf_s(buffer, MAX_PATH, TEXT("%s"), TEXT("NO"));
#endif
m_strOutput += buffer;
return false;
}
When the function finishes m_strOutput contains a string looking something like this:
-- ANSI-Compliant Predefined Macros --
SOURCE FILE [__FILE__]:f:\my source code\preprocessing\preprocessing\preprocessingdlg.cpp
MODIFIED [__TIMESTAMP__]:Wed Nov 4 13:24:24 2009
COMPILED [__DATE__]:Nov 4 2009 at 13:24:25
This is line number [__LINE__]:184
ANSI C/C++ Standard Conformance [__STDC__]:NO
- 11/4/2009
- ddaS-edEn
- 2/19/2009
- Alex Telea
- 10/6/2008
- Stephen W. Nuchia
See http://support.microsoft.com/kb/65472 for more info for earlier versions
- 4/3/2008
- BobF
'작업 > OvmStart(2010)' 카테고리의 다른 글
winecfg (0) | 2010.11.01 |
---|---|
winehq dotnet install (0) | 2010.10.28 |
n900에서 IrfanView로 jpg 이미지 읽기 성공 (0) | 2010.10.06 |
winetricks usage (0) | 2010.08.24 |
Test Presentation File (0) | 2010.08.10 |