Archive for the ‘Preprocessing’ Category

where to place inline keyword, in definition or declaration?

class Foo {
public:
void method(); ← best practice: don’t put the inline keyword here

};
inline void Foo::method() ← best practice: put the inline keyword here
{ … }
Here’s the basic idea:

The public: part of the class body is where you describe the observable semantics of a class, its public member functions, its friend functions, and anything [...]

Continue Reading..
Posted in Preprocessing

Do inline functions improve performance?

Yes and no. Sometimes. Maybe.
There are no simple answers. inline functions might make the code faster, they might make it slower. They might make the executable larger, they might make it smaller. They might cause thrashing, they might prevent thrashing. And they might be, and often are, totally irrelevant [...]

Continue Reading..
Posted in Preprocessing