TAL Programmer's Guide Data Alignment Addendum
Table Of Contents

TAL Misalignment Examples
TAL Programmer's Guide Data Alignment Addendum—524967-003
4-3
Invalid Conversion of Odd-Byte String Addresses
2. Equating pointers without direct assignment
Equating a pointer with another pointer or with an integer is safe when the values
of the equations are mutually exclusive in time or when an equivalent explicit
assignment of the address value would be correct at run time. See Example 4-4 on
page 4-5.
3. Calling a misdeclared external procedure
Actual parameters are implicitly assigned to formal parameters, by pointer or by
value. If formal parameters are described incorrectly to the caller, these implicit
assignments are equivalent to equivalenced formal parameters. See Example 4-5
on page 4-5.
4. Check-sum or hashing functions that use 16-bit or 32-bit ADD or XOR operations
Some TNS programs use check-sum or hashing functions that use a series of 16-
bit or 32-bit ADD or XOR operations to reduce an arbitrary-length byte string to 16
or 32 bits. If the string begins on an even-byte boundary, this is often coded as an
array of int elements overlaying the byte string. If the string can begin at an
arbitrary address, the loop must not use int pointers. See Example 4-6 on
page 4-6.
5. Storing the length of a byte string in its first two bytes
If the string can begin at an arbitrary address, then the two bytes in which the
length is stored must be stored and accessed as separate bytes, not as a single
short integer. See:
•
Example 4-2 on page 4-4
•
Example 4-3 on page 4-5
•
Example 4-4 on page 4-5
6. Ending a byte string with multiple zero-filled bytes
The zero-filled bytes must be inserted by separate single-byte storage operations,
not by a single int storage operation.
7. Using an int pointer to retrieve or modify a single byte
See Example 4-7 on page 4-6.
8. Accessing bit vectors or dynamically selected bit fields
Some programs that access bit vectors or dynamically selected bit fields have
accidentally become dependent on rounded-down addresses. See Example 4-8 on
page 4-7.
9. Calling the atomic (uninterruptible) memory-update functions
In TAL, the names of these functions begin with “$ATOMIC_”. The operands’
addresses must be aligned to work correctly.