H-Series Application Migration Guide (H06.07+, J06.03+)

Native C and C++ Migration Tasks
H-Series Application Migration Guide429855-008
5-4
Check C/C++ Main Routine Object File Name
Check C/C++ Main Routine Object File Name
The C and C++ main routine object file, which contains initialization code for the C and
C++ run-time libraries, has been renamed in the H-series RVUs. This change will affect
build scripts or any other link operation that specifies this file. The new names, along
with the equivalent TNS/R PIC and non-PIC names, are:
Check Programs With Variable-Length Parameter Lists
The TNS/E native C and C++ compilers use 64-bit containers for passing parameters,
instead of the 32-bit containers used by the TNS/R compilers. Programs that directly
manipulate parameter arguments in functions that have a variable-length parameter list
must be changed to manipulate the 64-bit containers. You should use the standard
macros in <stdarg.h> for parameter manipulation. Those macros allow you to write
portable functions that accept a variable number of parameters.
Using setjmp() in Functions Marked as Inline
Calling the setjmp() function in a function marked as inline and then doing a
subsequent longjmp() to the location of the calling function is a practice that should
be avoided. Programs that use setjmp() and longjmp() in this way generally
expect that functions marked as inline are actually inlined, and that the longjmp()
call will restore the execution context of the function that called setjmp().
In TNS/R programs compiled at optimization level 0, this is sometimes the case and
the longmp() call might work as expected. But in a TNS/E program compiled at
optimization level 0, functions marked as inline are never actually inlined, and the
longjmp() call will not restore the context of the function that called setjmp() and
give the expected result. A preferred practice is to use a macro instead of an inline
function.
Using the semctl() Function With a Fourth Parameter
The semctl() function has an optional fourth parameter that is required in certain
cases. As described in the Open System Services System Calls Reference Manual,
the value passed in that parameter must be defined in the calling program as a semun
union, as in this example:
union semun {
int val;
struct semid_ds *buf;
File Type Guardian Name OSS Name
TNS/R Non-PIC CRTLMAIN
crtlmain.o
TNS/R PIC CCPPMAIN
ccppmain.o
TNS/E CCPLMAIN
ccplmain.o