Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CPP_STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [Memory allocation](#memory-allocation)
* [Use `nullptr` instead of `NULL` or `0`](#use-nullptr-instead-of-null-or-0)
* [Ownership and Smart Pointers](#ownership-and-smart-pointers)
* [Avoid non-const references](#avoid-non-const-references)
* [Others](#others)
* [Type casting](#type-casting)
* [Do not include `*.h` if `*-inl.h` has already been included](#do-not-include-h-if--inlh-has-already-been-included)
Expand Down Expand Up @@ -200,6 +201,11 @@ void FooConsumer(std::unique_ptr<Foo> ptr);

Never use `std::auto_ptr`. Instead, use `std::unique_ptr`.

### Avoid non-const references

Using non-const references often obscures which values are changed by an
Comment thread
joyeecheung marked this conversation as resolved.
Comment thread
refack marked this conversation as resolved.
Comment thread
refack marked this conversation as resolved.
assignment. A pointer is almost always a better choice.

## Others

### Type casting
Expand Down