Default
Google

Preprocessors: Predefined Identifiers

Applies To: C++Builder 1 or higher
Category: C++ Language

C++Builder also offers predefined identifiers which will allow you to get specific information about the current project:
 
__BCOPT__: Defined in any compiler that has an optimizer.
 
__BCPLUSPLUS__: Defined if you've selected C++ compilation; will increase in later releases.
 
__BORLANDC__: Version number.
 
__CDECL__: Defined if Calling Convention is set to cdecl; otherwise undefined.
 
_CHAR_UNSIGNED: Defined by default indicating that the default char is unsigned char. Use the -K option to undefine this macro.
 
__CONSOLE__: When defined, the macro indicates that the program is a console application.
 
_CPPUNWIND: Enable stack unwinding.This is true by default; use -xd- to disable.
 
__cplusplus: Defined if in C++ mode; otherwise, undefined.
 
__DATE__: Date when processing began on the current file.
 
__DLL__: Defined whenever the -WD option is used; otherwise undefined.
 
__FILE__: Name of the current file being processed.
 
__FLAT__: Defined when compiling in 32-bit flat memory model.
 
__LINE__: Number of the current source file line being processed.
 
_M_IX86: Always defined. The default value is 300. You can change the value to 400 or 500 by using the /4 or /5 options.
 
__MSDOS__: Integer constant.
 
__MT__: Defined only if the -WM option is used. It specifies that the multithread library is to be linked.
 
__PASCAL__: Defined if Calling Convention is set to Pascal; otherwise undefined.
 
__STDC__: Defined if you compile with the -A option; otherwise, undefined.
 
__TCPLUSPLUS__: Version number.
 
_ _TEMPLATES_ _: Defined as 1 for C++ files (meaning that templates are supported); otherwise, it is undefined.
 
__TIME__: Time when processing began on the current file.
 
__TLS__: Thread Local Storage. Always true in C++Builder.
 
__TURBOC__: Will increase in later releases.
 
_WCHAR_T: Defined only for C++ programs to indicate that wchar_t is an intrinsically defined data type.
 
_WCHAR_T_DEFINED: Defined only for C++ programs to indicate that wchar_t is an intrinsically defined data type.
 
_Windows: Defined for Windows-only code.
 
__WIN32__: Defined for console and GUI applications.
 
For example, to obtain the version of C++Builder that is used to compile the project you can use the __BORLANDC__ identifier:
 
char *v;
#if __BORLANDC__ == 0x540
    v = "C++Builder 4";
#elif __BORLANDC__ == 0x530
    v = "C++Builder 3";
#endif

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange