Taking a Variable’s Address
int N; getlimit(&N); for (i = 0; i < N; i++) ...
Taking the address of a variable means that it must live in memory.
- The variable is then subject to pointer aliasing.
- Heavy use of the variable will be costly.
- Make a second, non-memory-bound, copy of the variable for intensive use.
When you take the address of a variable it is then memory-bound for its lifetime. So even if, as in this example, you only take the address once then use it later it’s still a memory-bound variable.