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

The number of significant characters in an identifier with no external linkage:
  • 1024
The number of significant characters in an identifier with external linkage:
  • 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.

Case sensitivity of external identifiers:
  • 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

Source and execution characters which are not specified by the ISO standard:
  • 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.
Shift states used for the encoding of multibyte characters:
  • The shift states are indicated with the SHIFTOUT (hex value \x0E) characters and SHIFTIN (hex value \x0F).
The number of bits that represent a single-byte character:
  • 8 bits
The mapping of members of the source character set (characters and strings) to the execution character set:
  • The same code page is used for the source and execution character set.
The value of an integer character constant that contains a character/escape sequence not represented in the basic execution character set:
  • A warning is issued for an unknown character/escape sequence and the char is assigned the character following the back slash.
The value of a wide character constant that contains a character/escape sequence not represented in the extended execution character set:
  • A warning is issued for the unknown character/escape sequence and the wchar_t is assigned the wide character following the back slash.
The value of an integer character constant that contains more than one character:
  • The lowest four bytes represent the character constant.
The value of a wide character constant that contains more than one multibyte character:
  • The lowest four bytes of the multibyte characters are converted to represent the wide character constant.
Equivalent type of char: signed char, unsigned char, or user-defined:
  • The default for char is unsigned
Sequence of white-space characters (excluding the new-line):
  • Any spaces or comments in the source program are interpreted as one space.

String conversion

Additional implementation-defined sequence forms that can be accepted by 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
The result of converting an integer to a signed char:
  • The lowest 1 byte of the integer is used to represent the char
The result of converting an integer from a shorter signed integer:
  • The lowest 2 bytes of the integer are used to represent the short int.
The result of converting an unsigned integer to a signed integer of equal length, if the value cannot be represented:
  • The bit pattern is preserved and the sign bit has no significance.
The result of bitwise operations (|, &, ^) on signed int:
  • The representation is treated as a bit pattern and 2's complement arithmetic is performed.
The sign of the remainder of integer division if either operand is negative:
  • The remainder is negative if exactly one operand is negative.
The result of a right shift of a negative-valued signed integral type:
  • 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:

C/C++ data mapping

The z/Architecture has the following boundaries in its memory mapping:
  • Byte
  • Halfword
  • Fullword
  • Doubleword
The code that is produced by the C/C++ compiler places data types on natural boundaries. Some examples are:
  • Byte boundary for char, _Bool/bool, and C only. decimal (n,p) C only.
  • Halfword boundary for short int
  • Fullword boundary for int, long int, pointers, float, and C only. float _Complex C only.
  • Doubleword boundary for double, long double, C only. double _Complex, and long double _Complex C only.

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

The type of size_t:
  • unsigned int in 32–bit mode
  • unsigned long in 64–bit mode
The type of ptrdiff_t:
  • int in 32–bit mode
  • long in 64–bit mode
The result of casting a pointer to an integer:
  • The bit patterns are preserved.
The result of casting an integer to a pointer:
  • The bit patterns are preserved.

Registers

The effect of the 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 when a member of a union object is accessed using a member of a different type:
  • The result is undefined.
The alignment/padding of structure members:
  • 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.
The padding at the end of structure/union:
  • Padding is added to end the structure on its natural boundary. The alignment of the structure or union is that of its strictest member.
The type of an int bit field (signed int, unsigned int, user defined):
  • The default is unsigned.
The order of allocation of bit fields within an int :
  • Bit fields are allocated from low memory to high memory. For example, 0x12345678 would be stored with byte 0 containing 0x12, and byte 3 containing 0x78.
The rule for bit fields crossing a storage unit boundary:
  • Bit fields can cross storage unit boundaries.
The integral type that represents the values of an enumeration type:
  • Enumerations can have the type char, short or long and be either signed or unsigned depending on their smallest and largest values.

Declarators

The maximum number of declarators (pointer, array, function) that can modify an arithmetic, structure, or union type:
  • The only constraint is the availability of system resources.

Statements

The maximum number of case values in a switch statement:
  • Because the case values must be integers and cannot be duplicated, the limit is INT_MAX.

Preprocessing directives

Value of a single-character constant in a constant expression that controls conditional inclusion:

Such a constant may have a negative value:
  • Yes
The method of searching include source files (<...>):
  • See z/OS XL C/C++ User's Guide.
The method of searching quoted source files:
  • User include files can be specified in double quotes. See z/OS XL C/C++ User's Guide.
The mapping between the name specified in the include directive and the external source file name:
  • See z/OS XL C/C++ User's Guide.
The definitions of __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.

Table 1. Translation Limits
Nesting levels of:  
  • Compound statements
  • Iteration control
  • Selection control
  • Conditional inclusion
  • Parenthesized declarators
  • Parenthesized expression
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • System-determined
Number of pointer, array and function declarators modifying an arithmetic a structure, a union, and incomplete type declaration

 

  • System-determined
Significant initial characters in:
  • Internal identifiers
  • Macro names
  • C external identifiers (without LONGNAME)
  • C external identifiers (with LONGNAME)
  • C++ external identifiers
 
  • 1024
  • 1024
  • 8
  • 1024
  • 1024
Number of:
  • External identifiers in a translation unit
  • Identifiers with block scope in one block
  • Macro identifiers simultaneously declared in a translation unit
  • Parameters in one function definition
  • Arguments in a function call
  • Parameters in a macro definition
  • Parameters in a macro invocation
  • Characters in a logical source line
  • Characters in a string literal
  • Bytes in an object
  • Nested include files
  • Enumeration constants in an enumeration
  • Levels in nested structure or union
 
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • System-determined
  • 32760 under MVS™
  • 32K minus 1
  • LONG_MAX (See 1)
  • SHRT_MAX
  • System-determined
  • System-determined
Note:
  1. LONG_MAX is the limit for automatic variables only. For all other variables, the limit is 16 megabytes.