C/C++ Programmer's Guide (G06.25+)
Mixed-Language Programming for TNS/R and
TNS/E Native Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
8-7
Considerations When Interfacing to pTAL
Using Identifiers
pTAL and C identifiers differ as follows:
•
pTAL and C have independent sets of reserved keywords.
•
pTAL identifiers can include circumflexes (^); C identifiers cannot.
•
The C language is case-sensitive; the pTAL language is not case-sensitive.
To declare variable identifiers that satisfy both compilers:
•
Avoid using reserved keywords in either language as identifiers.
•
Specify pTAL identifiers without circumflexes.
•
Specify C identifiers in uppercase.
•
For C or C++, you can use the _alias attribute specifier to describe the name of
an external pTAL routine that does not have a valid C name.
You can declare pTAL-only, or C-only routine identifiers and satisfy both compilers by
using the public name option in:
•
Interface declarations in C
•
EXTERNAL procedure declarations in pTAL
In G-series Inspect or H-series Native Inspect sessions:
•
Use uppercase for pTAL identifiers
•
Use the given case for C identifiers
Matching Data Types
Use data types that are compatible between languages for:
•
Shared global variables
•
Formal or actual parameters
•
Function return values
Table 8-1. Compatible pTAL and C Data Types (page 1 of 2)
pTAL Declaration pTAL Data Type C Data Type
Direct data
STRINGS i; STRING char
INT i; INT (signed) short
INT (32) j; INT(32) int
FIXED f; FIXED(0) long long
REAL r; REAL float
REAL(64) s; REAL(64) double
Indirect using 16-bit pointers using the pTAL or TAL model
STRING .s; STRING char
*