Skip to content

Commit

Permalink
Use pragma-once instead of ifdef header guards (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetiroka authored Jul 30, 2024
1 parent c541362 commit a4afddd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions styleguide/styleguide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ file contents are completely different, so please do not confuse the two. -->
</STYLEPOINT>

<STYLEPOINT title="Header file guards">
<SUMMARY>All header files should have #define guards, and they should be in the format "#ifndef MY_CLASS_H_".</SUMMARY>
<SUMMARY>All header files should have #pragma once guards.</SUMMARY>
<BODY>
<p>The C++ standard technically does not allow source code files to define macros that start with an underscore or contain a double underscore.</p>
<p>The C++ standard technically does not allow #pragma once, but all major compilers support it. It is also much easier to use than regular header guards.</p>
</BODY>
</STYLEPOINT>

Expand Down

0 comments on commit a4afddd

Please sign in to comment.