Skip to content

Commit d954c46

Browse files
authored
Adjust spacing in C6393 warning examples
1 parent f165e31 commit d954c46

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/code-quality/c6393.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ Code analysis name: `LEAP_YEAR_INVALID_DATE_KEYED_LOOKUP`
2626
The following code creates a lookup table for the day of the year, assuming 365 days per year. However, this doesn't work if the year is a leap year:
2727

2828
```cpp
29-
#include <vector>
30-
31-
void foo(int year)
32-
{
33-
const std::vector<int> items(365); // C6393
34-
// Initialize items and use it...
29+
#include <vector>
30+
31+
void foo(int year)
32+
{
33+
const std::vector<int> items(365); // C6393
34+
// Initialize items and use it...
3535
}
3636
```
3737
3838
To fix the problem, adjust the size of the lookup table as the table is created according to the result of appropriate leap year check:
3939
4040
```cpp
41-
#include <vector>
42-
43-
void foo(int year)
44-
{
45-
bool isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
46-
const std::vector<int> items(isLeapYear ? 366 : 365);
47-
// Initialize items and use it...
41+
#include <vector>
42+
43+
void foo(int year)
44+
{
45+
bool isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
46+
const std::vector<int> items(isLeapYear ? 366 : 365);
47+
// Initialize items and use it...
4848
}
4949
```
5050

0 commit comments

Comments
 (0)