comparison STYLE.md @ 52:02ec33e7ca7f default tip @

minor fixes
author David Demelier <markand@malikania.fr>
date Thu, 17 Dec 2020 10:33:19 +0100
parents 884ef6321dcc
children
comparison
equal deleted inserted replaced
51:884ef6321dcc 52:02ec33e7ca7f
1 PROJECT NAME CODING STYLE 1 PROJECT_NAME CODING STYLE
2 ========================= 2 =========================
3 3
4 File content 4 File content
5 ============ 5 ============
6 6
202 - Filenames are all lowercase. 202 - Filenames are all lowercase.
203 203
204 ### Comments 204 ### Comments
205 205
206 Avoid useless comments in source files. Comment complex things or why it is done 206 Avoid useless comments in source files. Comment complex things or why it is done
207 like this. However any public function in the .h **must** be documented as 207 like this. Do not use `//` style comments in C.
208 doxygen without exception.
209 208
210 ```c 209 ```c
211 /* 210 /*
212 * Multi line comments look like 211 * Multi line comments look like
213 * this. 212 * this.
214 */ 213 */
215 214
216 // Short comment 215 /* Short comment. */
217 ``` 216 ```
218 217
219 Use `#if 0` to comment blocks of code. 218 Use `#if 0` to comment blocks of code.
220 219
221 ```c 220 ```c
246 Programming 245 Programming
247 ----------- 246 -----------
248 247
249 ### C Standard 248 ### C Standard
250 249
251 Use C99 standard without extensions. 250 Use C11 standard without extensions.
252 251
253 ### Assertions 252 ### Assertions
254 253
255 Use the `assert` macro from the assert.h header file to verify programming 254 Use the `assert` macro from the assert.h header file to verify programming
256 errors. 255 errors.
460 - Filenames are all lowercase. 459 - Filenames are all lowercase.
461 460
462 ### Comments 461 ### Comments
463 462
464 Avoid useless comments in source files. Comment complex things or why it is done 463 Avoid useless comments in source files. Comment complex things or why it is done
465 like this. However any public function in the .hpp **must** be documented as 464 like this.
466 doxygen without exception.
467 465
468 ```cpp 466 ```cpp
469 /* 467 /*
470 * Multi line comments look like 468 * Multi line comments look like
471 * this. 469 * this.
613 elision: 611 elision:
614 612
615 ```cpp 613 ```cpp
616 std::vector<int> v{1, 2, 3}; 614 std::vector<int> v{1, 2, 3};
617 615
618 foo({1, 2}); // type deduced 616 foo({1, 2}); // type deduced
619 617
620 return { "true", false }; // std::pair returned 618 return { "true", false }; // std::pair returned
621 ``` 619 ```
622 620
623 Use the assignment for primitive types: 621 Use the assignment for primitive types:
624 622
625 ```cpp 623 ```cpp
980 978
981 Code blocks 979 Code blocks
982 ----------- 980 -----------
983 981
984 You can use three backticks and the language specifier or just indent a block by 982 You can use three backticks and the language specifier or just indent a block by
985 for leading spaces if you don't need syntax. 983 for leading tabs if you don't need syntax.
986 984
987 ```cpp 985 ```cpp
988 std::cout << "hello world" << std::endl; 986 std::cout << "hello world" << std::endl;
989 ``` 987 ```
990 988