Implementation-defined behavior
This information describes how the z/OS® XL C/C++ compilers define some of the implementation-specific behavior from the ISO C and C++ standards. In-depth usage information is provided in z/OS XL C/C++ User's Guide and z/OS XL C/C++ Programming Guide.
Identifiers
- 1024
- 1024 with the compile-time option LONGNAME specified
- 8 otherwise
The C++ compiler truncates external identifiers without C++ linkage after 8 characters if the NOLONGNAME compiler option or pragma is in effect.
- The binder accepts all external names up to 1024 characters, and is optionally case sensitive. The linkage editor accepts all external names up to 8 characters, and may not be case sensitive, depending on whether you use the NOLONGNAME compiler option or pragma. When the NOLONGNAME option is used, all external names are truncated to 8 characters. As an aid to portability, identifiers that are not unique after truncation are flagged as an error.
Characters
- The caret (^) character in ASCII (bitwise exclusive OR symbol) or the equivalent not (¬) character in EBCDIC.
- The vertical broken line character in ASCII which may be represented by the vertical line (|) character on EBCDIC systems.
- The shift states are indicated with the SHIFTOUT (hex value \x0E) characters and SHIFTIN (hex value \x0F).
- 8 bits
- The same code page is used for the source and execution character set.
- A warning is issued for an unknown character/escape sequence and
the
char
is assigned the character following the back slash.
- A warning is issued for the unknown character/escape sequence
and the
wchar_t
is assigned the wide character following the back slash.
- The lowest four bytes represent the character constant.
- The lowest four bytes of the multibyte characters are converted to represent the wide character constant.
char
: signed
char
, unsigned char
, or user-defined: - The default for
char
isunsigned
- Any spaces or comments in the source program are interpreted as one space.
String conversion
strtod
, strtol
and strtoul
functions
in other than the C locale: - None
Integers
Type | Amount of storage | Range (in limits.h ) |
---|---|---|
signed short |
2 bytes | -32,768 to 32,767 |
unsigned short |
2 bytes | 0 to 65,535 |
signed int |
4 bytes | -2,147,483,647 minus 1 to 2,147,483,647 |
unsigned int |
4 bytes | 0 to 4,294,967,295 |
signed long |
4 bytes | -2,147,483,647 minus 1 to 2,147,483,647 |
unsigned long |
4 bytes | 0 to 4,294,967,295 |
signed long long |
8 bytes | -9,223,372,036,854,775,807 minus 1 to 9,223,372,036,854,775,807 |
unsigned long long |
8 bytes | 0 to 18,446,744,073,709,551,615 |
signed
char
: - The lowest 1 byte of the integer is used to represent the
char
- The lowest 2 bytes of the integer are used to represent the
short int
.
- The bit pattern is preserved and the sign bit has no significance.
signed
int
: - The representation is treated as a bit pattern and 2's complement arithmetic is performed.
- The remainder is negative if exactly one operand is negative.
- The result is sign-extended and the sign is propagated.
Floating-point numbers
Type | Amount of storage | Range (approximate) | |
---|---|---|---|
IBM® z/Architecture® hexadecimal format | IEEE binary format | ||
float |
4 bytes | 5.5x10-79 to 7.2x1075 | 1.2x10-38 to 3.4x1038 |
double |
8 bytes | 5.5x10-79 to 7.2x1075 | 2.2x10-308 to 1.8x10308 |
long double |
16 bytes | 5.5x10-79 to 7.2x1075 | 3.4x10-4932 to 1.2x104932 |
The following is the direction of truncation (or rounding) when you convert an integer number to an IBM z/Architecture hexadecimal floating-point number, or to an IEEE binary floating-point number:
- IBM z/Architecture hexadecimal format:
When the floating-point cannot exactly represent the original value, the value is truncated.
When a floating-point number is converted to a narrower floating-point number, the floating-point number is truncated.
- IEEE binary format:
The rounding direction is determined by the ROUND compiler option. The ROUND option only affects the rounding of floating-point values that the z/OS XL C/C++ compiler can evaluate at compile time. It has no effect on rounding at run time.
C/C++ data mapping
- Byte
- Halfword
- Fullword
- Doubleword
- Byte boundary for
char
,_Bool
/bool
, anddecimal
(n,p) - Halfword boundary for
short int
- Fullword boundary for
int
,long int
, pointers,float
, andfloat _Complex
- Doubleword boundary for
double
,long double
,double _Complex
, andlong double _Complex
For each external defined variable, the z/OS XL C/C++ compiler defines a writeable static data instance of the same name. The compiler places other external variables, such as those in programs that you compile with the NORENT compiler option, in separate csects that are based on their names.
Arrays and pointers
size_t
: unsigned int
in 32–bit modeunsigned long
in 64–bit mode
ptrdiff_t
: int
in 32–bit modelong
in 64–bit mode
- The bit patterns are preserved.
- The bit patterns are preserved.
Registers
register
storage
class specifier on the storage of objects in registers: - The register storage class indicates to the compiler that a variable
in a block scope data definition or a parameter declaration is heavily
used (such as a loop control variable). It is equivalent to
auto
, except that the compiler might, if possible, place the variable into a machine register for faster access.
Structures, unions, enumerations, bit fields
- The result is undefined.
- If the structure is not packed, then padding is added to align the structure members on their natural boundaries. If the structure is packed, no padding is added.
- Padding is added to end the structure on its natural boundary. The alignment of the structure or union is that of its strictest member.
int
bit field (signed
int
, unsigned int
, user defined): - The default is
unsigned
.
int
: - Bit fields are allocated from low memory to high memory. For example,
0x12345678
would be stored with byte 0 containing0x12
, and byte 3 containing0x78
.
- Bit fields can cross storage unit boundaries.
- Enumerations can have the type
char
,short
orlong
and be eithersigned
orunsigned
depending on their smallest and largest values.
Declarators
- The only constraint is the availability of system resources.
Statements
case
values in a switch
statement: - Because the
case
values must be integers and cannot be duplicated, the limit isINT_MAX
.
Preprocessing directives
Value of a single-character constant in a constant expression that controls conditional inclusion:
- Matches the value of the character constant in the execution character set.
- Yes
<...>
):
- User include files can be specified in double quotes. See z/OS XL C/C++ User's Guide.
__DATE__
and __TIME__
when date and time of translation is not available: - For z/OS XL C/C++, the date and time of translation are always available.
Translation limits
System-determined means that the limit is determined by your system resources.
Nesting levels of: | |
---|---|
|
|
Number of pointer, array and function declarators modifying an arithmetic a structure, a union, and incomplete type declaration |
|
Significant initial characters in:
|
|
Number of:
|
|
Note:
|