⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpwcc.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
📖 第 1 页 / 共 5 页
字号:
directives are present in the file, the compiler can issue error
messages in terms of the original source file line numbers.
.*
.section *refid=wccmacs &product Predefined Macros
.*
.np
In addition to the standard ISO-defined macros supported by the
&product compilers, several additional system-dependent macros are
also defined.
These are described in this section.
See the
.book &company C Language Reference
manual for a description of the standard macros.
.np
The &product compilers run on various host operating systems
including DOS, OS/2, Windows NT, Windows 95 and QNX.
Any of the supported host operating systems can be used to develop
applications for a number of target systems.
By default, the target operating system for the application is the
same as the host operating system unless some option or combination of
options is specified.
For example, DOS applications are built on DOS by default, OS/2
applications are built on OS/2 by default, and so on.
But the flexibility is there to build applications for other operating
systems/environments.
.np
The macros described below may be used to identify the target system
for which the application is being compiled.
(Note: In several places in the following text, a pair of underscore
characters appears as __ which resembles a single, elongated
underscore.)
.np
The &product compilers support both 16-bit and 32-bit application
development.
The following macros are defined for 16-bit and 32-bit target systems.
.ix 'macros' '__X86__'
.ix '__X86__'
.ix 'macros' '__I86__'
.ix '__I86__'
.ix 'macros' '__386__'
.ix '__386__'
.ix 'macros' 'M_I86'
.ix 'M_I86'
.ix 'macros' 'M_I386'
.ix 'M_I386'
.ix 'macros' '_M_I86'
.ix '_M_I86'
.ix 'macros' '_M_I386'
.ix '_M_I386'
.ix 'macros' '_M_IX86'
.ix '_M_IX86'
.millust begin
 16-bit      32-bit
========    ========
__X86__     __X86__
__I86__     __386__
M_I86       M_I386
_M_I86      _M_I386
_M_IX86     _M_IX86
.millust end
.autonote Notes:
.note
The
.kwm __X86__
identifies the target as an Intel environment.
.note
The
.kwm __I86__,
.kwm M_I86
and
.kwm _M_I86
macros identify the target as a 16-bit Intel environment.
.note
The
.kwm __386__,
.kwm M_I386
and
.kwm _M_I386
macros identify the target as a 32-bit Intel environment.
.note
The
.kwm _M_IX86
macro is identically equal to 100 times the architecture compiler
option value (&sw.0, &sw.1, &sw.2, &sw.3, &sw.4, &sw.5, etc.).
If "&sw.5" (Pentium instruction timings) was specified as a compiler
option, then the value of
.kwm _M_IX86
would be 500.
.endnote
.np
The &product compilers support application development for a
variety of operating systems.
The following macros are defined for particular target operating
systems.
.ix 'macros' '_DOS'
.ix '_DOS'
.ix 'macros' '__DOS__'
.ix '__DOS__'
.ix 'macros' 'MSDOS'
.ix 'MSDOS'
.ix 'macros' '__OS2__'
.ix '__OS2__'
.ix 'macros' '__QNX__'
.ix '__QNX__'
.ix 'macros' '__NETWARE__'
.ix '__NETWARE__'
.ix 'macros' '__NETWARE_386__'
.ix '__NETWARE_386__'
.ix 'macros' '__NT__'
.ix '__NT__'
.ix 'macros' '_WINDOWS'
.ix '_WINDOWS'
.ix 'macros' '__WINDOWS__'
.ix '__WINDOWS__'
.ix 'macros' '__WINDOWS_386__'
.ix '__WINDOWS_386__'
.ix 'macros' '__UNIX__'
.ix '__UNIX__'
.ix 'macros' '__LINUX__'
.ix '__LINUX__'
.millust begin
Target      Macros
======      ======================================
DOS         __DOS__, _DOS, MSDOS
OS/2        __OS2__
QNX         __QNX__, __UNIX__
Netware     __NETWARE__, __NETWARE_386__
NT          __NT__
Windows     __WINDOWS__, _WINDOWS, __WINDOWS_386__
Linux       __LINUX__, __UNIX__
.millust end
.autonote Notes:
.note
The
.kwm __DOS__,
.kwm _DOS
and
.kwm MSDOS
macros are defined when the build target is "DOS" (16-bit DOS or
32-bit extended DOS).
.note
The
.kwm __OS2__
macro is defined when the build target is "OS2" (16-bit or 32-bit
OS/2).
.note
The
.kwm __QNX__
and
.kwm __UNIX__
macros are defined when the build target is "QNX" (16-bit or 32-bit
QNX).
.note
The
.kwm __NETWARE__
and
.kwm __NETWARE_386__
macros are defined when the build target is "NETWARE" (Novell NetWare).
.note
The
.kwm __NT__
macro is defined when the build target is "NT" (Windows NT and Windows
95).
.note
The
.kwm __WINDOWS__
macro is defined when the build target is "WINDOWS" or one of the
"zw", "zW", "zWs" options is specified (identifies the target
operating system as 16-bit Windows or 32-bit extended Windows but not
Windows NT or Windows 95).
.note
The
.kwm _WINDOWS
macro is defined when the build target is "WINDOWS" or one of the
"zw", "zW", "zWs" options is specified and you are using a 16-bit
compiler (identifies the target operating system as 16-bit Windows).
.note
The
.kwm __WINDOWS_386__
macro is defined when the build target is "WINDOWS" or the "zw" option
is specified and you are using a 32-bit compiler (identifies the
target operating system as 32-bit extended Windows).
.note
The
.kwm __LINUX__
and
.kwm __UNIX__
macros are defined when the build target is "LINUX" (32-bit Linux).
.endnote
.np
The following macros are defined for the indicated options.
.ix 'macros' '__FPI__'
.ix '__FPI__'
.ix 'macros' '__CHAR_SIGNED__'
.ix '__CHAR_SIGNED__'
.ix 'macros' '__INLINE_FUNCTIONS__'
.ix '__INLINE_FUNCTIONS__'
.ix 'macros' 'NO_EXT_KEYS'
.ix 'NO_EXT_KEYS'
.millust begin
Option    Macro
====== ==================
bm     _MT
br     _DLL
fpi    __FPI__
fpi87  __FPI__
j      __CHAR_SIGNED__
oi     __INLINE_FUNCTIONS__
xr     _CPPRTTI (C++ only)
xs     _CPPUNWIND (C++ only)
xss    _CPPUNWIND (C++ only)
xst    _CPPUNWIND (C++ only)
za     NO_EXT_KEYS
zw     __WINDOWS__
zW     __WINDOWS__
zWs    __WINDOWS__
.millust end
.np
The following memory model macros are defined for the indicated memory
model options.
.ix 'macros' '__FLAT__'
.ix 'macros' '__SMALL__'
.ix 'macros' '__MEDIUM__'
.ix 'macros' '__COMPACT__'
.ix 'macros' '__LARGE__'
.ix 'macros' '__HUGE__'
.ix 'macros' 'M_I86SM'
.ix 'macros' 'M_I86MM'
.ix 'macros' 'M_I86CM'
.ix 'macros' 'M_I86LM'
.ix 'macros' 'M_I86HM'
.ix 'macros' '_M_I86SM'
.ix 'macros' '_M_I86MM'
.ix 'macros' '_M_I86CM'
.ix 'macros' '_M_I86LM'
.ix 'macros' '_M_I86HM'
.ix 'macros' 'M_386FM'
.ix 'macros' 'M_386SM'
.ix 'macros' 'M_386MM'
.ix 'macros' 'M_386CM'
.ix 'macros' 'M_386LM'
.ix 'macros' '_M_386FM'
.ix 'macros' '_M_386SM'
.ix 'macros' '_M_386MM'
.ix 'macros' '_M_386CM'
.ix 'macros' '_M_386LM'
.millust begin
Option     All        16-bit only          32-bit only
====== =========== =================    =================
mf     __FLAT__                         M_386FM  _M_386FM
ms     __SMALL__   M_I86SM  _M_I86SM    M_386SM  _M_386SM
mm     __MEDIUM__  M_I86MM  _M_I86MM    M_386MM  _M_386MM
mc     __COMPACT__ M_I86CM  _M_I86CM    M_386CM  _M_386CM
ml     __LARGE__   M_I86LM  _M_I86LM    M_386LM  _M_386LM
mh     __HUGE__    M_I86HM  _M_I86HM
.millust end
.np
The following macros indicate which compiler is compiling the C/C++
source code.
.begnote $break
.*
.note __cplusplus
.ix 'macros' '__cplusplus'
.ix '__cplusplus'
&cmppname predefines the macro
.kwm __cplusplus
to identify the compiler as a C++ compiler.
.*
.note __WATCOMC__
.ix 'macros' '__WATCOMC__'
.ix '__WATCOMC__'
&product predefines the macro
.kwm __WATCOMC__
to identify the compiler as one of the &product compilers.
.np
The value of the macro depends on the version number of the compiler.
The value is 100 times the version number (version 8.5 yields 850,
version 9.0 yields 900, etc.). Note that for Open Watcom 1.0, the
value of this macro is 1200, for Open Watcom 1.1 it is 1210 etc.
.*
.note __WATCOM_CPLUSPLUS__
.ix 'macros' '__WATCOM_CPLUSPLUS__'
.ix '__WATCOM_CPLUSPLUS__'
&cmppname predefines the macro
.kwm __WATCOM_CPLUSPLUS__
to identify the compiler as one of the &cmppname compilers.
.np
The value of the macro depends on the version number of the compiler.
The value is 100 times the version number (version 10.0 yields 1000,
version 10.5 yields 1050, etc.). Note that for Open Watcom 1.0, the
value of this macro is 1200, for Open Watcom 1.1 it is 1210 etc.
.*
.endnote
.np
The following macros are defined for compatibility with Microsoft.
.begnote $break
.*
.note __CPPRTTI
.ix 'macros' '__CPPRTTI'
.ix '__CPPRTTI'
&cmppname predefines the
.kwm __CPPRTTI
macro to indicate that C++ Run-Time Type Information (RTTI) is in
force.
This macro is predefined if the &cmppname "xr" compile option is
specified and is not defined otherwise.
.*
.note __CPPUNWIND
.ix 'macros' '__CPPUNWIND'
.ix '__CPPUNWIND'
&cmppname predefines the
.kwm __CPPUNWIND
macro to indicate that C++ exceptions supported.
This macro is predefined if any of the &cmppname "xs", "xss" or "xst"
compile options are specified and is not defined otherwise.
.*
.note _INTEGRAL_MAX_BITS
.ix 'macros' '_INTEGRAL_MAX_BITS'
.ix '_INTEGRAL_MAX_BITS'
.ix 'keywords' '__int64'
&product predefines the
.kwm _INTEGRAL_MAX_BITS
macro to indicate that maximum number of bits supported in an integral
type (see the description of the "__int64" keyword in the next section).
Its value is 64 currently.
.*
.note _PUSHPOP_SUPPORTED
.ix 'macros' '_PUSHPOP_SUPPORTED'
.ix '_PUSHPOP_SUPPORTED'
&product predefines the
.kwm _PUSHPOP_SUPPORTED
macro to indicate that
.mono #pragma pack(push)
and
.mono #pragma pack(pop)
are supported.
.*
.note _STDCALL_SUPPORTED
.ix 'macros' '_STDCALL_SUPPORTED'
.ix '_STDCALL_SUPPORTED'
&product predefines the
.kwm _STDCALL_SUPPORTED
macro to indicate that the standard 32-bit Win32 calling convention is
supported.
.endnote
.np
The following table summarizes the predefined macros supported by the
compilers and the values that the respective compilers assign to them.
A "yes" under the column means that the compiler supports the macro
with the indicated value.
Note that the C and C++ compilers sometime support the same macro but
with different values (including no value which means the symbol is
defined without a value).
.code begin
Predefined Macro                Supported by Compiler
 and Setting                wcc     wcc386  wpp     wpp386
--------------------------- ------  ------  ------  ------
__386__=1                             Yes             Yes
__3R__=1                                              Yes
_based=__based                Yes     Yes     Yes     Yes
_cdecl=__cdecl                Yes     Yes     Yes     Yes
cdecl=__cdecl                 Yes     Yes     Yes     Yes
__cplusplus=1                                 Yes     Yes
_CPPRTTI=1                                    Yes     Yes
_CPPUNWIND=1                                  Yes     Yes
_export=__export              Yes     Yes     Yes     Yes
_far16=__far16                Yes     Yes     Yes     Yes
_far=__far                    Yes     Yes     Yes     Yes
far=__far                     Yes     Yes     Yes     Yes
_fastcall=__fastcall          Yes     Yes     Yes     Yes
__FLAT__=1                            Yes             Yes
_fortran=__fortran            Yes     Yes     Yes     Yes
fortran=__fortran             Yes     Yes     Yes     Yes
__FPI__=1                     Yes     Yes     Yes     Yes
_huge=__huge                  Yes     Yes     Yes     Yes
huge=__huge                   Yes     Yes     Yes     Yes
__I86__=1                     Yes             Yes
_inline=__inline              Yes     Yes     Yes     Yes
_INTEGRAL_MAX_BITS=64         Yes     Yes     Yes     Yes
_interrupt=__interrupt        Yes     Yes     Yes     Yes
interrupt=__interrupt         Yes     Yes     Yes     Yes
_loadds=__loadds              Yes     Yes     Yes     Yes
_M_386FM=1                                            Yes
M_386FM=1                                             Yes
_M_I386=1                             Yes             Yes
M_I386=1                              Yes             Yes
_M_I86=1                      Yes             Yes
M_I86=1                       Yes             Yes
_M_I86SM=1                    Yes             Yes
M_I86SM=1                     Yes             Yes
_M_IX86=0                     Yes             Yes
_M_IX86=500                           Yes             Yes
_near=__near                  Yes     Yes     Yes     Yes
near=__near                   Yes     Yes     Yes     Yes
__NT__=1 (on Win32 platform)  Yes     Yes     Yes     Yes
_pascal=__pascal              Yes     Yes     Yes     Yes
pascal=__pascal               Yes     Yes     Yes     Yes
_saveregs=__saveregs          Yes     Yes     Yes     Yes
_segment=__segment            Yes     Yes     Yes     Yes
_segname=__segname            Yes     Yes     Yes     Yes
_self=__self                  Yes     Yes     Yes     Yes
__SMALL__=1                   Yes             Yes
SOMDLINK=__far                Yes
SOMDLINK=_Syscall                     Yes             Yes
SOMLINK=__cdecl               Yes
SOMLINK=_Syscall                      Yes             Yes
_STDCALL_SUPPORTED=1                  Yes             Yes
__SW_0=1                      Yes             Yes
__SW_3R=1                             Yes             Yes
__SW_5=1                              Yes             Yes
__SW_FP287=1                                  Yes
__SW_FP2=1                    Yes
__SW_FP387=1                                          Yes
__SW_FP3=1                            Yes
__SW_FPI=1                    Yes     Yes     Yes     Yes
__SW_MF=1                             Yes             Yes
__SW_MS=1                     Yes
__SW_ZDP=1                    Yes     Yes     Yes     Yes
__SW_ZFP=1                    Yes     Yes     Yes     Yes
__SW_ZGF=1                            Yes             Yes
__SW_ZGP=1                    Yes             Yes
_stdcall=__stdcall            Yes     Yes     Yes     Yes
_syscall=__syscall            Yes     Yes     Yes     Yes
__WATCOM_CPLUSPLUS__=&vermacro                     Yes     Yes
__WATCOMC__=&vermacro              Yes     Yes     Yes     Yes
__X86__=1                     Yes     Yes     Yes     Yes
.code end
.*
.section *refid=wccext &product Extended Keywords
.*
.np
&product supports the use of some special keywords to describe system
dependent attributes of functions and other object names.
These attributes are inspired by the Intel processor architecture and
the plethora of function calling conventions in use by compilers for
this architecture.
In keeping with the ISO C and C++ language standards, &product
uses the double underscore (i.e., "__") or single underscore followed
by uppercase letter (e.g., "_S") prefix with these keywords.
To support compatibility with other C/C++ compilers, alternate forms
of these keywords are also supported through predefined macros.
.*
.begnote $break
.*
.note __near &optdag.
.ix 'keywords' '__near'
&product supports the
.kwm __near

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -