H-Series Application Migration Guide (H06.03+)
Native C and C++ Migration Tasks
H-Series Application Migration Guide—429855-006
5-11
Undefined Behavior in C and C++ Programs
Undefined Behavior in C and C++ Programs
The C and C++ International Standards declare certain language behavior to be either
unspecified or undefined. These behaviors might differ between TNS/R and TNS/E
programs, so any programs that depend on such behavior should be changed to use to
eliminate the dependency. Coding practices to be avoided include but are not limited
to:
•
Dependence on the order in which expressions are evaluated
•
Dependence on the order in which certain side effects take place
•
Dependence on the order in which a function designator and the arguments in the
function call are evaluated
•
Arithmetic conversions that produce a result that cannot be represented in the
space provided
•
Objects that are modified more than once, or are modified and accessed other
than to determine the new value, between two sequence points
•
Arithmetic operations that are invalid (such as a division by zero or modulus zero)
or produce a result that cannot be represented in the space provided (such as an
overflow or underflow)
•
Function calls which do not have a function prototype and the number of
arguments does not match the number of parameters
•
Function calls which do not have a function prototype and the types of the
arguments after promotion do not agree with those of the parameters after
promotion
•
Calling a function with a function prototype but the function is not defined with a
compatible type
•
Assigning an object to an overlapping object
•
Using a function value when no value was returned
•
Accessing an object of automatic storage class that does not have volatile-qualified
type and has been changed between a setjmp() invocation and a longjmp() call
New H-Series C and C++ Features
The following features are new in TNS/E native C and C++. Use of these features is
not required, but they might provide certain benefits.