... not explicitly used the
inline keyword. Today’s optimizing compilers are so sophisticated that it’s best to leave inlining decisions to the compiler.
Figure 6.16 uses
cube (lines 9–11) to calculate the volume of a cube. Keyword
const in function
cube’s parameter list (line 9) tells the compiler that the function does not modify variable
side. This ensures that
side’s value is not changed by the function during the calculation. (Keyword
const is discussed in additional detail in Chapters 7–9.)
const qualifier should be used to enforce the principle of least privilege. Using this principle to ...