-
Notifications
You must be signed in to change notification settings - Fork 38
All definitions should reside in source files. #6
Comments
And templates? |
And what about autodoc? In general, I put all autodoc in source file to keep headers clean, excepted for templates and inline members. |
I agree that all implementations should be in separate files. Can we have inlines/template implementations in |
Just a general comment: In my own experience, I realized that simplicity of access to the code is also important, and not only theoretical clarity should be considered. For instance, with small classes it makes sense to group them in a single pair of .h/.cpp files. I know that some people are using fairly sophisticated IDE, but some other people are using simpler editors. The file structure should not be uselessly complicated. I think that the common sense should have more importance than strict guidelines. |
Stephane, do you mean that, is some cases, we should relax this policy and allow inline functions defined in the header? I think that could fit under the rule:
|
|
I fully agree with Hannes! I also agree with you Paul that this could fit under the "rule violation because of common sense" rule. But I believe that as the guide we are writing is also a help for people not at ease with C++, it should help them to get a feeling how to code reasonably. One problem with beginners, just after very ugly code, is over-complicated code. I think that in the guide we should also give a feeling that coding has an artistic part, with an important common-sense component. Large classes holding significant part of the program logic should of course lie in their own files, but collections of support classes, especially when they are inter-dependant and templatized, are better grouped in a single or few files, in my opinion. |
@HannesSommer Hannes could you integrate your comment to the style-guide? Thanks! |
What about inlining?
If inlining is desired, the respective function definition should be moved to a separate implementation header which is included at the end of the header.
The text was updated successfully, but these errors were encountered: