mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Fix indentation of NR.1 example
This commit is contained in:
parent
94a7a3fd46
commit
e3fe0c5b5e
|
@ -17997,23 +17997,23 @@ This leads to longer programs and more errors caused by uninitialized and wrongl
|
|||
|
||||
##### Example, bad
|
||||
|
||||
int use(int x)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
double d;
|
||||
int use(int x)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
double d;
|
||||
|
||||
// ... some stuff ...
|
||||
// ... some stuff ...
|
||||
|
||||
if (x < i) {
|
||||
// ...
|
||||
i = f(x, d);
|
||||
}
|
||||
if (i < x) {
|
||||
// ...
|
||||
i = g(x, c);
|
||||
}
|
||||
return i;
|
||||
if (x < i) {
|
||||
// ...
|
||||
i = f(x, d);
|
||||
}
|
||||
if (i < x) {
|
||||
// ...
|
||||
i = g(x, c);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
The larger the distance between the uninitialized variable and its use, the larger the chance of a bug.
|
||||
|
|
Loading…
Reference in New Issue
Block a user