FAQ 13.03 Are there any special rules about inlining?

Yes. Here are a few rules about inlining.

  1. Any source file that contains usage of an inline function must contain the function's definition.

  2. An inline function must be identically defined everywhere. The easy way to do this is to define it once, preferably in the class header file, and include the definition as needed. The hard way is to carefully redefine the function everywhere and learn the one-definition rule (see FAQ 13.04). But even the easy way has a potential glitch, so read FAQ 13.04 regardless.

  3. main() cannot be inline.

But these are just language rules that tell how to do inline functions. To find out when to do inline functions, read the rest of this chapter.



C++ FAQs
C Programming FAQs: Frequently Asked Questions
ISBN: 0201845199
EAN: 2147483647
Year: 2005
Pages: 566
Authors: Steve Summit

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net