July 2000
Intermediate to advanced
1280 pages
34h 55m
English
Another useful technique associated with program modularization with C++ functions is the use of inline functions. As you saw earlier, argument copying and context switching during the function call might affect the size of the stack memory that the program needs and its performance. These are important issues. When a function is small and is called often from functions with a large number of local variables, it is a pity to waste time and stack memory for saving the caller environment for the sake of executing a few lines of code.
Consider, for example, the function that computes tax by using a constant coefficient.
double tax(double gross)
{ return gross * 0.05; }When the client code calls this function, the "context" of ...
Read now
Unlock full access