Editing C++ style guide

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 139: Line 139:
=== Function headers ===
=== Function headers ===


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


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
Line 149: Line 149:
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 character after the open
multi-line argument lists should be aligned on the first char after the open
parenthesis.  Put a space before the left open parenthesis and after
parenthesis.  You should 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 ===
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: