0

In the book "Inside the C++ Object Model", the author says that, "Each inline function has either zero or one definition of itself generated within each module in which it is used." Can any body tell under what conditions will there be zero definition generated?

1 Answer 1

1

If every instance which the inline function is used, can be inlined/compiler decides to inline them all, then no instances of the function are necessary in the translation unit.

2
  • Take the following code as an example: class A { public: inline void func(){}; }; Do you mean that the function inline void fund(){} is not a definition? Sep 9, 2015 at 10:57
  • It is but where compiler will put generated assembly instructions for its body? It may be in one translation unit (in C++ compiler is free to pick the one he prefers) or zero (always inlined, not pointers to, no need for a body anywhere because its code is merged and optimized at calling points) Sep 9, 2015 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.