Skip to content

Commit 9cc906a

Browse files
add Header Guard Convention
1 parent 7f161f7 commit 9cc906a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

doc/src/dev/coding_style.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22
Coding Style
33
=============
44

5+
.. note::
6+
7+
Many of the rules and conventions described in this document are not yet followed consistently throughout the codebase.
8+
They represent the direction we want to move in.
9+
Contributors are encouraged to adopt these guidelines in new code and when modifying existing code,
10+
so that the project gradually becomes more consistent and maintainable over time.
11+
12+
Header Guard Convention
13+
~~~~~~~~~~~~~~~~~~~~~
14+
15+
- Always use ``#pragma once`` as the first line in every header file, even before any file-level comments or code.
16+
17+
It is recommended that ``#pragma once`` appears before the file comment.
18+
The reason is that file comments may be duplicated each time the header is included,
19+
which can slow down compilation in large codebases due to extra file I/O.
20+
21+
Example:
22+
23+
.. code-block:: cpp
24+
25+
#pragma once
26+
27+
/**
28+
* @file netlist_walker.h
29+
* @brief Utilities for traversing the netlist.
30+
*/
31+
// ...rest of header...
32+
533
Naming Conventions
634
~~~~~~~~~~~~~
735

0 commit comments

Comments
 (0)