[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
side_effects

Description:
Controls the use of pointer aliases.
Compatibility:
This pragma is compatible with the following platform targets:
Prototype:
#pragma side_effects on | off | reset
Remarks:
If your program does not use pointer aliases, turn off this pragma to make your program smaller and faster. If your program does use pointer aliases, turn on this pragma to avoid incorrect code. A pointer alias looks like this:
int a, *p;
p = &a; // *p is an alias for a.
To understand why pointer aliases are so important, remember that the compiler needs to load a variable into a register before performing arithmetic on it. So, in the example below, the compiler loads a into a register before the first addition. If *p is an alias for a, the compiler needs to load a into a register again before the second addition, since changing *p also changed a. If *p is not an alias for a, the compiler doesn't need to load a into a register again, since changing *p does not change a.
x = a + 1;
*p = 0; // If *p is an alias for a,
y = a + 2; // this changes a.
This pragma does not correspond to an option in any settings panel. To check whether this pragma is on, use __option (side_effects), described in "Checking Options." By default, this pragma is on.
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 17, 2000