mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Declaring one name per declaration.
This commit is contained in:
parent
46f38a7917
commit
6a39167b86
|
@ -7880,9 +7880,10 @@ The *always initialize* rule is a style rule aimed to improve maintainability as
|
||||||
|
|
||||||
Here is an example that is often considered to demonstrate the need for a more relaxed rule for initialization
|
Here is an example that is often considered to demonstrate the need for a more relaxed rule for initialization
|
||||||
|
|
||||||
widget i, j; // "widget" a type that's expensive to initialize, possibly a large POD
|
widget i; // "widget" a type that's expensive to initialize, possibly a large POD
|
||||||
|
widget j;
|
||||||
|
|
||||||
if (cond) { // bad: i and j are initialized "late"
|
if (cond) { // bad: i and j are initialized "late"
|
||||||
i = f1();
|
i = f1();
|
||||||
j = f2();
|
j = f2();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user