mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 14:57:52 +00:00
Fix internal conflicts in CODING_GUIDELINES.md.
This commit is contained in:
parent
74fcee2d7d
commit
187180f986
@ -43,11 +43,11 @@ if (condition) {
|
|||||||
//code
|
//code
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int a=0; a<b; ++b) {
|
for (int a = 0; a < b; ++b) {
|
||||||
//code
|
//code
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(a) {
|
switch (a) {
|
||||||
case 1:
|
case 1:
|
||||||
//blah
|
//blah
|
||||||
case 2:
|
case 2:
|
||||||
@ -59,13 +59,17 @@ default:
|
|||||||
|
|
||||||
#### c. Blocks in switch's case labels ####
|
#### c. Blocks in switch's case labels ####
|
||||||
```c++
|
```c++
|
||||||
switch (var)
|
switch (var) {
|
||||||
case 1: {
|
case 1: {
|
||||||
//declare local variables
|
//declare local variables
|
||||||
//code
|
//code
|
||||||
}
|
}
|
||||||
case 2:
|
break;
|
||||||
//code
|
case 2: {
|
||||||
|
//declare local variables
|
||||||
|
//code
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
//code
|
//code
|
||||||
}
|
}
|
||||||
@ -90,16 +94,16 @@ The `else if`/`else` must be on their own lines.
|
|||||||
**Most** single statement if blocks should look like this:
|
**Most** single statement if blocks should look like this:
|
||||||
```c++
|
```c++
|
||||||
if (condition)
|
if (condition)
|
||||||
a = a +b;
|
a = a + b;
|
||||||
```
|
```
|
||||||
|
|
||||||
One acceptable exception to this **can be** `return` or `break` statements, provided that the test condition isn't very long. However you can choose to use the first rule instead.
|
One acceptable exception to this **can be** `return`, `break` or `continue` statements, provided that the test condition isn't very long. However you can choose to use the first rule instead.
|
||||||
```c++
|
```c++
|
||||||
a = myFunction();
|
a = myFunction();
|
||||||
b = a*1500;
|
b = a * 1500;
|
||||||
|
|
||||||
if (b>0) return;
|
if (b > 0) return;
|
||||||
c = 100/b;
|
c = 100 / b;
|
||||||
```
|
```
|
||||||
|
|
||||||
#### c. Using curly braces for single statement if blocks ####
|
#### c. Using curly braces for single statement if blocks ####
|
||||||
@ -159,7 +163,7 @@ a += "b"
|
|||||||
|
|
||||||
Before and after the assignment there should be a space. One exception could be: for loops.
|
Before and after the assignment there should be a space. One exception could be: for loops.
|
||||||
```c++
|
```c++
|
||||||
for(int a=0; a<b; ++b) {
|
for (int a=0; a<b; ++b) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user