TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–19
STRING and char Variables
TAL STRING and C char simple variables each occupies one byte of a word.
Following are STRING and char compatibility guidelines:
Share variables of type TAL STRING and C char by using pointers.
Declare TAL STRING and C char formal parameters as reference parameters to
avoid the following value parameter incompatibility:
When you pass a STRING parameter to a C routine, the actual byte value
occupies the left byte of the word allocated for the C char formal parameter.
When you pass a char parameter to a TAL routine, the actual byte value
occupies the right byte of the word allocated for the TAL STRING formal
parameters.
For example, if you declare a TAL STRING formal parameter as a value parameter
rather than as a reference parameter, the TAL routine can access the C char actual
parameter only by explicitly referring to the right byte of the word allocated for the
STRING formal parameter:
PROC sample (s);
STRING s; !Declare TAL STRING parameter as a
BEGIN ! value (not reference) parameter
STRING dest;
dest := s[1]; !Refer to right byte of word
END:
Arrays
TAL and C arrays differ as follows:
Characteristic TAL Array C Array
Lower bound Any integer Always zero
Dimensions One dimension One or more dimensions
Direct or indirect Direct or indirect Indirect only
Byte or word addressing STRING arrays and extended
indirect arrays are byte
addressed; all other arrays are
word addressed
char arrays and large-memory-
model arrays are byte
addressed; all other arrays are
word addressed
TAL structures can emulate multidimensional C arrays, as discussed in
“Multidimensional Arrays” later in this section.
To declare compatible TAL and C arrays:
Use data types and alignments that satisfy both compilers.
Declare TAL arrays that have a lower bound of 0.
Declare one-dimensional C arrays.
Declare indirect TAL arrays.