Chapter Contents |
Previous |
Next |
Developing Applications for Use with UNIX System Services OS/390 |
The POSIX.1 standard specifies three levels of conformance:
Strictly Conforming POSIX Programs |
A POSIX program is strictly conforming if it uses only ISO/ANSI
and POSIX standard library features and does not depend on any undefined or
implementation-defined behavior. If you want a program to strictly conform
to the POSIX.1 standards, you should define the feature test
macro
_POSIX_SOURCE
before including any standard header file. (One way
to define this symbol is using the
define
compiler option.) When
_POSIX_SOURCE
is defined, the only declarations included in standard header files
are those of standard symbols. This ensures that any symbols defined by your
application will not conflict with any non-POSIX extensions defined in the
standard header files.
The symbol
_POSIX1_SOURCE
can be defined to the value 2 to define
a program that is strictly conforming except for its use of features from
the POSIX.1a draft standard. If
_POSIX1_SOURCE
is defined to 2, then
_POSIX_SOURCE
need not
be defined.
POSIX Programs with Extensions |
Many programs use POSIX functionality but are not intended to
be strictly conforming. For instance, a socket application cannot be strictly
conforming, since sockets are not defined by the POSIX.1 or POSIX.1a standard.
If the feature test macro
_POSIX_SOURCE
is defined, then critical declarations
(for instance, the type
fd_set
) will be omitted from headers like
<sys/types.h>
, which
will cause a socket application to fail to compile.
SAS/C Release
6.00 defines the feature test macro
_SASC_POSIX_SOURCE
to specify POSIX
functionality plus SAS/C functionality.
If the symbol
_SASC_POSIX_SOURCE
is defined before inclusion of the first system
header file, then ISO/ANSI and POSIX header files will define ISO/ANSI and
POSIX functionality, plus SAS/C extensions.
If you define one of
_POSIX_SOURCE
or
_POSIX1_SOURCE
as well as
_SASC_POSIX_SOURCE
, the
standard feature test macro has precedence, that is, SAS/C extensions
will not be defined.
If you do not define any feature test macro, then POSIX
header files may include definitions of SAS/C extensions.
However, ISO/ANSI header files will define only ISO/ANSI sanctioned symbols.
Therefore, if you want to use POSIX functionality defined in ISO/ANSI header
files (for example, the
fdopen
routine declared in
<stdio.h>
), you should
define a feature test macro.
Note that the preferred method of defining the
_SASC_POSIX_SOURCE
feature test macro is to specify the
posix
option at compile time.
Portability Considerations |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.