C++ style guide: Difference between revisions

Jump to navigation Jump to search
458 bytes added ,  20 December 2023
m
Line 18: Line 18:
* Use only spaces, with 2 spaces per indent.
* Use only spaces, with 2 spaces per indent.
* Tabs are prohibited.
* Tabs are prohibited.
==== Functions, class, struct, enum ====
The curly braces defining the beginning and end of the block should appear on their own line.
The braces should not be indented, i.e., they align at the same indentation level as the keyword such as {{codeline|class}}.
The body of the block is indented.
Example:
<syntaxhighlight lang="cpp">
class MatrixType
{
public:
  enum matrix_type
  {
    Unknown = 0,
    Full,
    Rectangular
  };
}
</syntaxhighlight>


==== Control structures (if, while, ...) ====
==== Control structures (if, while, ...) ====
1,072

edits

Navigation menu