Commit 04f62053 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther

HACKING: Clarify braces in if-else

Document common practice in the other files.
parent a0f3c356
......@@ -69,6 +69,62 @@ if (i < 0)
}
```
Single line `if` or `else` statements don't need braces but if either `if` or
`else` have braces both get them:
*Good*:
```c
if (i < 0)
i++;
else
i--;
```
```c
if (i < 0) {
i++;
j++;
} else {
i--;
}
```
```c
if (i < 0) {
i++;
} else {
i--;
j--;
}
```
*Bad*:
```c
if (i < 0) {
i++;
} else {
i--;
}
```
```c
if (i < 0) {
i++;
j++;
} else
i--;
```
```c
if (i < 0)
i++;
else {
i--;
j--;
}
```
Header Inclusion Guards
-----------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment