On Aug 1, 2013, at 10:34 AM, Johan Engelen wrote:
The example we are discussing is ~SPPoint(){} that's as trivial as you can get, and so no need to argue about non-trivial functions. I think is very nice if simple functions like that are written inside the header. Saves some time wading through lengthy .cpp files only to find an almost empty function. If a function only has a return .........; statement, it is nice to see that in the header. There is emphasis on compilation time in your argument, but developer reading time is also important.
Well... I did say I was addressing a 'general' problem. For a coder going to *use* a class, the members should not mean anything at all. So the public API of the .h file can actually be clearer by leaving them off. If one needs to know what a function does, it's doc comment should declare it. Implementing is a different matter.
*however* in this specific case there is an even simpler solution. If we are speaking of a destructor that does nothing, we can just not declare it at all. If C++ does not see an explicit destructor, the compiler will automatically do the equivalent of ~SPPoint(){} and there is no need to explicitly add it.