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

pTAL Migration Tasks
H-Series Application Migration Guide429855-006
7-4
Using PLATFORM and AUTO Alignment
Using PLATFORM and AUTO Alignment
The PLATFORM directive causes the pTAL compiler to use the same data alignment
as other compilers on the same platform. That alignment might differ from the
alignment produced by the same compiler on a different platform. The AUTO directive
allows the compiler to determine data alignment based on what is most efficient. AUTO
alignment is not guaranteed to be the same on different platforms or for different
compilers on the same platform, and programs should not assume that PLATFORM
and AUTO alignments are the same. Therefore, TNS/R and TNS/E pTAL programs
that share data should not use PLATFORM or AUTO alignment. They should instead
use the SHARED2 and SHARED8 directives as appropriate.
In addition, AUTO alignment should be used only by programs that are not dependent
on any particular data alignment. If a program contains logic that is dependent on a
particular data alignment, use the SHARED2, SHARED8, and PLATFORM directives
as appropriate.
Using RETURN/RETURNSCC in Mixed
Language Programs
This topic applies to pTAL procedures that do all of the following:
Return a traditional function value by means of the RETURN statement.
Return an unrelated condition code value by means of the RETURNSCC attribute.
Are called by C or C++ procedures.
On the TNS platform, a TAL procedure can return both a traditional function value and
an unrelated condition code value. Both return values are accessible after the
procedure call. pTAL procedures emulate this behavior on both the TNS/R and TNS/E
platforms, but C and C++ procedures do not.
On the TNS/R platform, if a C or C++ procedure calls a pTAL procedure that returns
both a traditional function value and a condition code value, the C or C++ compiler
issues an error message.
It is possible to work around this C/C++ compile-time error by writing C/C++ prototypes
that rely on the knowledge that on the TNS/R platform, pTAL object code stores the
two return values as a single concatenated 64-bit value. After the C/C++ procedure
calls the pTAL procedure, it extracts from the 64-bit container either both return values
or only the traditional function value.
These C and C++ prototypes are not guaranteed to work on the TNS/R platform, and
extracting only the traditional function value does not work on the TNS/E platform.
The TNS/E pTAL compiler issues a warning whenever a pTAL procedure returns both
a traditional function value and a condition code value. To migrate such a procedure to
TNS/E, HP recommends that you: