Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tiger
assignments
Commits
dea6afc6
Commit
dea6afc6
authored
Feb 17, 2021
by
Mael Cravero
Committed by
Pierre Brandone
Jan 16, 2022
Browse files
instructions: file_conventions: update section
* source/instructions/coding_style/file_conventions.rst: Here.
parent
8df12188
Changes
1
Show whitespace changes
Inline
Side-by-side
source/instructions/coding_style/file_conventions.rst
View file @
dea6afc6
...
...
@@ -3,7 +3,7 @@
File Conventions
----------------
There are some strict conventions to obey
wrt
the files and their
There are some strict conventions to obey
regarding
the files and their
contents.
Rule: One class :code:`LikeThis` per files :code:`like-this.*`
...
...
@@ -18,7 +18,7 @@ Rule: :code:`*.hh`: Declarations
The :code:`*.hh` should contain only declarations, i.e., prototypes,
:code:`extern` for variables etc. Inlined short methods are accepted
when there are few of them, otherwise, create an :code:`*.hxx` file. The
documentation should be here too.
documentation should be here
in the :code:`*.hh`
too.
There is no good reason for huge objects to be defined here.
...
...
@@ -45,6 +45,12 @@ Rule: :code:`*.hh`: Declarations
Actually, if you merely need to declare the existence
of streams, you might want to include :code:`iosfwd`.
Relevant C++ Core Guidelines:
- :cppcgl:`sf2-a-h-file-may-not-contain-object-definitions-or-non-inline-function-definitions`
- :cppcgl:`sf4-include-h-files-before-other-declarations-in-a-file`
- :cppcgl:`sf10-avoid-dependencies-on-implicitly-included-names`
- :cppcgl:`sf11-header-files-should-be-self-contained`
Rule: :code:`*.hxx`: Inlined definitions
Some definitions should be loaded in different places: templates, inline
functions etc. Declare and document them in the :code:`*.hh` file, and
...
...
@@ -52,6 +58,8 @@ Rule: :code:`*.hxx`: Inlined definitions
*last* includes the :code:`*.hxx` file, conversely :code:`*.hxx`
*first* includes :code:`*.hh`. Read below.
Relevant C++ Core Guidelines:
- :cppcgl:`f5-if-a-function-is-very-small-and-time-critical-declare-it-inline`
Rule: :code:`*.cc`: Definitions of functions and variables
Big objects should be defined in the :code:`*.cc` file corresponding to
...
...
@@ -68,8 +76,7 @@ Rule: :code:`*.cc`: Definitions of functions and variables
.. code-block:: c++
void
LetExp::accept(Visitor& v)
void LetExp::accept(Visitor& v)
{
v(*this);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment