The /STANDARD qualifier selects the dialect of the C language
supported.
With the exception of /STANDARD=ANSI89 and /STANDARD=ISOC94, the
selection of C dialect and the selection of C RTL APIs to
use are independent choices. All other values for /STANDARD cause
the entire set of APIs to be available, including extensions.
Specifying /STANDARD=ANSI89 restricts the default API set to the
ANSI C set. In this case, to select a broader set of APIs, you
must also specify the appropriate feature-test macro. To select
the ANSI C dialect and all APIs, including extensions, undefine
__HIDE_FORBIDDEN_NAMES before including any header file.
Compiling with /STANDARD=ISOC94 sets __STDC_VERSION__ to
199409. Conflicts that arise when compiling with both XPG4 and
ISO C Amendment 1 resolve in favor of ISO C Amendment 1. XPG4
extensions to ISO C Amendment 1 are selected by defining _XOPEN_
SOURCE.
The following examples help clarify these rules:
o The fdopen function is an ISO POSIX-1 extension to <stdio.h>.
Therefore, <stdio.h> defines fdopen only if one or more of the
following is true:
- The program including it is not compiled in strict ANSI C
mode (/STANDARD=ANSI89).
- _POSIX_C_SOURCE is defined as 1 or greater.
- _XOPEN_SOURCE is defined.
- _XOPEN_SOURCE_EXTENDED is defined.
o The popen function is an ISO POSIX-2 extension to <stdio.h>.
Therefore, <stdio.h> defines popen only if one or more of the
following is true:
- The program including it is not compiled in strict ANSI C
mode (/STANDARD=ANSI89).
- _POSIX_C_SOURCE is defined as 2 or greater.
- _XOPEN_SOURCE is defined.
- _XOPEN_SOURCE_EXTENDED is defined.
o The getw function is an X/Open extension to <stdio.h>.
Therefore, <stdio.h> defines getw only if one or more of the
following is true:
- The program is not compiled in strict ANSI C mode
(/STANDARD=ANSI89).
- _XOPEN_SOURCE is defined.
- _XOPEN_SOURCE_EXTENDED is defined.
o The X/Open Extended symbolic constants _SC_PAGESIZE,
_SC_PAGE_SIZE, _SC_ATEXIT_MAX, and _SC_IOV_MAX were added
to <unistd.h> to support the sysconf function. However, these
constants are not defined by _POSIX_C_SOURCE.
The <unistd.h> header file defines these constants only if
a program does not define _POSIX_C_SOURCE and does define
_XOPEN_SOURCE_EXTENDED.
If _POSIX_C_SOURCE is defined, these constants are not visible
in <unistd.h>. Note that _POSIX_C_SOURCE is defined only for
programs compiled in strict ANSI C mode.
o The fgetname function is a C RTL extension to
<stdio.h>. Therefore, <stdio.h> defines fgetname only
if the program is not compiled in strict ANSI C mode
(/STANDARD=ANSI89).
o The macro _PTHREAD_KEYS_MAX is defined by POSIX 1003.1c-1995.
This macro is made visible in <limits.h> when compiling for
this standard with _POSIX_C_SOURCE == 199506 defined, or
by default when compiling without any standards-defining,
feature-test macros.
o The macro WCHAR_MAX defined in <wchar.h> is required by ISO C
Amendment 1 but not by XPG4. Therefore:
- Compiling for ISO C Amendment 1 makes this symbol visible,
but compiling for XPG4 compliance does not.
- Compiling for both ISO C Amendment 1 and XPG4 makes this
symbol visible.
Similarly, the functions wcsftime and wcstok in <wchar.h>
are defined slightly differently by the ISO C Amendment 1 and
XPG4:
- Compiling for ISO C Amendment 1 makes the ISO C Amendment 1
prototypes visible.
- Compiling for XPG4 compliance makes the XPG4 prototypes
visible.
- Compiling for both ISO C Amendment 1 and XPG4 selects the
ISO C prototypes because conflicts resulting from this mode
of compilation resolve in favor of ISO C.
- Compiling without any standard selecting feature test
macros makes ISO C Amendment 1 features visible.
In this example, compiling with no standard-selecting
feature-test macros makes WCHAR_MAX and the ISO C Amendment 1
prototypes for wcsftime and wcstok visible.
o The wcswidth and wcwidth functions are XPG4 extensions to
ISO C Amendment 1. Their prototypes are in <wchar.h>.
These symbols are visible if:
- Compiling for XPG4 compliance by defining _XOPEN_SOURCE or
_XOPEN_SOURCE_EXTENDED.
- Compiling for DEC C Version 4.0 compatibility or on pre-
OpenVMS Version 7.0 systems.
- Compiling with no standard-selecting feature-test macros.
- Compiling for both ISO C Amendment 1 and XPG4 compilance
because these symbols are XPG4 extensions to ISO C
Amendment 1.
Compiling for strict ISO C Amendment 1 does not make them
visible.