int ExplodeBomb(const int megatons_requested); inline void ExampleUse() { int megatons_requested = 10; int megatons_used; // Here is how you might use the ExplodeBomb function: megatons_used = ExplodeBomb(megatons_requested); } // If the function is renamed or the number/type of parameters // changes the ExampleUse() function won't compile and you can fix it.
Programming Tips - Sometimes comments that refer to code get out of date.
Date: 2005Jun1
Language: C/C++
Keywords: compiled
Q. Sometimes comments that refer to code get out of date.
Is there a way to avoid this without adding to the size of the program?
A. Compile your comments in an inline function but never call the function.
A good use of this trick to document an API in the header file.
Here's an example header file: