5

I was reading this. It says that

Define functions inline only when they are small, say, 10 lines or less.

But Bjarne Stroustrup in his book Programming Principles and Practices using C++ says that:

Section 9.4: Defining member functions

"The obvious rule of thumb is: Don't put member function bodies in the class declaration unless you know that you need the performance boost from inlining tiny functions. Large functions, say five lines of code, don't benefit from inlining. We rarely inline a function that consists of more than one or two expressions.

So is it appropriate & helpful to define a function having 10 lines or at least 10 lines as inline. Doesn't that make program executable file size larger or even compiler can ignore the request for inlining such big function? Is Google C++ style gives incorrect guidelines about usage of inline functions in C++?

Community
  • 1
  • 1
Destructor
  • 14,123
  • 11
  • 61
  • 126
  • 1
    [When to use inline function and when not to use it?](http://stackoverflow.com/questions/1932311/when-to-use-inline-function-and-when-not-to-use-it) – Daniel Daranas Apr 23 '15 at 15:06
  • 11
    google c++ style guide is not recommended to follow except for internal google code. It has some very bad advices regarding c++. Very bad. It's the guide they use internally so just take it as that, not as a general C++ guide you should emply on your projects/everyday life – bolov Apr 23 '15 at 15:08

0 Answers0