I'm trying to rewrite some code I wrote time ago using some C++ good practices. To achieve such a goal I'm using as reference Effective C++ (1) and google coding convention (2). According to (2) a function should be declared inline if it is 10 lines or less, according to (1) furthermore the compiler could ignore the inline directive, for example when there are loops or recursion (just some example is provided so I don't know all the cases that would be ignored by the compiler).
Say I then have 2 functions, the first one is 10 lines, and there's no call to any other function and no external reference in general. The second one assume is still 10 lines but at some point there's a call to the first one
Something like
Type1 f(Type2 arg) {
//10 lines of self contained code
}
Type3 g(Type4 arg) {
//0 <= n <= 8 lines of code
//g(x);
//9 - n lines of code
}
I would declare the f
inline, because of the suggestion given by google (fully justified) But I would be puzzled about g
what would be a good practice here? Would declaring g
as inline ignored by the compiler? If not can I still have the benefits of the inline directive?