mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
resolving #1238 about style
The caveat is added only to the subset of rules where it appears to be relevant
This commit is contained in:
parent
dd4cae0260
commit
c11001f0a6
|
@ -3613,7 +3613,7 @@ A returned rvalue reference goes out of scope at the end of the full expression
|
|||
This kind of use is a frequent source of bugs, often incorrectly reported as a compiler bug.
|
||||
An implementer of a function should avoid setting such traps for users.
|
||||
|
||||
The [lifetipe safety profile](#SS-lifetime) will (when completely implemented) catch such problems
|
||||
The [lifetipe safety profile](#SS-lifetime) will (when completely implemented) catch such problems.
|
||||
|
||||
|
||||
##### Example
|
||||
|
@ -20232,7 +20232,7 @@ Consistent naming and layout are helpful.
|
|||
If for no other reason because it minimizes "my style is better than your style" arguments.
|
||||
However, there are many, many, different styles around and people are passionate about them (pro and con).
|
||||
Also, most real-world projects includes code from many sources, so standardizing on a single style for all code is often impossible.
|
||||
We present a set of rules that you might use if you have no better ideas, but the real aim is consistency, rather than any particular rule set.
|
||||
After many requests for guidance from users, we present a set of rules that you might use if you have no better ideas, but the real aim is consistency, rather than any particular rule set.
|
||||
IDEs and tools can help (as well as hinder).
|
||||
|
||||
Naming and layout rules:
|
||||
|
@ -20531,6 +20531,9 @@ This rule is a default to use only if you have a choice.
|
|||
Often, you don't have a choice and must follow an established style for [consistency](#Rl-name).
|
||||
The need for consistency beats personal taste.
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Example
|
||||
|
||||
[Stroustrup](http://www.stroustrup.com/Programming/PPP-style.pdf):
|
||||
|
@ -20572,6 +20575,9 @@ Too much space makes the text larger and distracts.
|
|||
|
||||
Some IDEs have their own opinions and add distracting space.
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Note
|
||||
|
||||
We value well-placed whitespace as a significant help for readability. Just don't overdo it.
|
||||
|
@ -20623,6 +20629,9 @@ When declaring a class use the following order
|
|||
|
||||
Use the `public` before `protected` before `private` order.
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Example
|
||||
|
||||
class X {
|
||||
|
@ -20677,6 +20686,9 @@ This is the original C and C++ layout. It preserves vertical space well. It dist
|
|||
|
||||
In the context of C++, this style is often called "Stroustrup".
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Example
|
||||
|
||||
struct Cable {
|
||||
|
@ -20748,6 +20760,11 @@ The use in expressions argument doesn't hold for references.
|
|||
T &operator[](size_t); // just strange
|
||||
T & operator[](size_t); // undecided
|
||||
|
||||
##### Note
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Enforcement
|
||||
|
||||
Impossible in the face of history.
|
||||
|
@ -20844,6 +20861,9 @@ but they also confuse more people, especially novices relying on teaching materi
|
|||
|
||||
As ever, remember that the aim of these naming and layout rules is consistency and that aesthetics vary immensely.
|
||||
|
||||
This is a recommendation for [when you have no constraints or better ideas](#S-naming).
|
||||
Thus rule was added after many requests for guidance.
|
||||
|
||||
##### Enforcement
|
||||
|
||||
Flag `const` used as a suffix for a type.
|
||||
|
|
Loading…
Reference in New Issue
Block a user