diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-06-27 20:08:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-27 20:08:53 -0700 |
| commit | fd32b1879c8a4de7e97a99be7e0e8093ade8b340 (patch) | |
| tree | 70e18e84c70c61dbbb8d158218811b9a3bd2f580 /docs/design | |
| parent | 323fdff4544ac3b640bdc617d7f7d64ab56fbf5a (diff) | |
Update the coding convention document. (#4498)
Put space between control-flow and `(`. This is a default formatting
setting of Visual Studio 2019 and 2022. And we have been writing the
code in this style for a while.
Diffstat (limited to 'docs/design')
| -rw-r--r-- | docs/design/coding-conventions.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/design/coding-conventions.md b/docs/design/coding-conventions.md index 95d2a42ae..2dffaff49 100644 --- a/docs/design/coding-conventions.md +++ b/docs/design/coding-conventions.md @@ -200,15 +200,16 @@ case JUST_A: doA(); break; case JUST_B: doB(); break; ``` -Don't put space between a control-flow keyword and a following `(`. +Put space between a control-flow keyword and a following `(`. +This is a default setting of Visual Studio 2019 and 2022. Examples of how to format the major C++ control-flow constructs follow: ```c++ void example() { - for(int ii = 0; ii < N; ++ii) + for (int ii = 0; ii < N; ++ii) { - if(ii == 0) + if (ii == 0) { } else @@ -217,7 +218,7 @@ void example() } int x = 0; - while(x < 100) + while (x < 100) { x++; } @@ -225,7 +226,7 @@ void example() int mode = 0; do { - switch(mode) + switch (mode) { case 0: x /= 2; @@ -240,7 +241,7 @@ void example() mode--; break; } - } while(x > 0); + } while (x > 0); } ``` |
