C++ style guide: Difference between revisions

Jump to navigation Jump to search
182 bytes added ,  20 December 2023
m
Line 103: Line 103:
=== Function headers ===
=== Function headers ===


Format function headers like this:
In general, in non-header files, format function headers like this:


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
Line 113: Line 113:
The return type of the function and any modifiers are specified on the first
The return type of the function and any modifiers are specified on the first
line.  The function name on the second line should start in column 1, and
line.  The function name on the second line should start in column 1, and
multi-line argument lists should be aligned on the first char after the open
multi-line argument lists should be aligned on the first character after the open
parenthesis.  You should put a space before the left open parenthesis and after
parenthesis.  Put a space before the left open parenthesis and after
commas, for both function definitions and function calls.
commas, for both function definitions and function calls.
For header files, or in class definitions, it may look better not to split the return type from the rest of the function header.  Use your own judgement.


=== Class declarations ===
=== Class declarations ===
1,072

edits

Navigation menu