TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
17–24 096254 Tandem Computers Incorporated
Redefinitions and Unions
Variant records are approximated by TAL structure redefinitions and C unions.
A TAL redefinition declares a structure item that uses the same memory location as an
existing structure item. The existing structure item can be a simple variable, array,
substructure, or pointer that:
Begins on a word boundary
Is at the same BEGIN-END level in the structure as the redefinition
Is the same size or larger than the redefinition
A C union defines a set of variables that can have different data types and whose
values alternatively share the same portion of memory. The size of a union is the size
of its largest variable; the largest item need not come first. A union always begins on
a word boundary.
Here is an example of TAL redefinitions and equivalent C unions:
TAL Code C Code
STRUCT mtns (
*
); struct Mtns
 BEGIN { union {
 INT(32) tamalpais; long Tamalpais;
 INT diablo = tamalpais; short Diablo;
 STRING hamilton = diablo; char Hamilton;} Calif_mtns;
 FIXED num; union {
 STRUCT cascade = num; long long Num;
 BEGIN struct {
 INT ranier; short Ranier;
 INT sthelens; short StHelens;
 INT adams; short Adams;
 INT hood; short Hood; } Cascade;
 END; } Northern_mtns;
 END; };
STRUCT c_high (mtns); struct Mtns High;
The following identifiers access equivalent structure items in the preceding example:
In TAL: c_high.diablo
In C: High.Calif_mtns.Diablo










