Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C++ styleguide #584

Merged

Conversation

zetafunction
Copy link
Contributor

  • Guidance for return values (prefer return by value, return by
    reference, then return by pointer in that order)
  • Mandate curly braces around the body of a control statement,
    providing one exception for historical reasons (if with no else,
    and if + body fits completely in a single line or the if fits in
    one line and the body fits in another separate line).

- Guidance for return values (prefer return by value, return by
  reference, then return by pointer in that order)
- Mandate curly braces around the body of a control statement,
  providing one exception for historical reasons (`if` with no `else`,
  and `if` + body fits completely in a single line or the `if` fits in
  one line and the body fits in another separate line).
@google-cla google-cla bot added the cla: yes label Nov 11, 2020
@zetafunction zetafunction changed the title Update Google C++ styleguide Update C++ styleguide Nov 11, 2020
@zetafunction
Copy link
Contributor Author

@tituswinters Please take a look when you have a chance. Thanks!

Copy link

@wp-seth wp-seth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small note. all in all i welcome those corrections/updates/simplifications/precisions.

@@ -1719,6 +1719,9 @@ <h3 id="Inputs_and_Outputs">Inputs and Outputs</h3>
improve readability, and often provide the same or better
performance.</p>

<p>Prefer to return by value or, failing that, return by reference.
Avoid returning a pointer unless it can be null.</p>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Avoid returning a pointer unless it can be null.</p>
Avoid returning a pointer unless you take care of the case if it is null.</p>

otherwise it could be misunderstood.

@tituswinters tituswinters merged commit d5b5104 into google:gh-pages Nov 11, 2020
@zetafunction zetafunction deleted the yet-again-how-does-this-work branch January 27, 2021 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants