|
| 1 | +<!-- |
| 2 | + SPDX-FileCopyrightText: © 2018 Team CharLS |
| 3 | + SPDX-License-Identifier: BSD-3-Clause |
| 4 | +--> |
| 5 | + |
1 | 6 | # Comments on disabled Visual Studio C++ Core Guidelines Rules
|
2 | 7 |
|
3 |
| -C26426: Global initializer calls a non-constexpr function 'xxx' |
4 |
| --> Rationale: many false warnings. CharLS is a library, globals are correctly initialized. |
| 8 | +This document contains the rationales why some Microsoft |
| 9 | +C++ warnings are disabled in the file default.ruleset |
| 10 | +It is not possible to add this info to the .ruleset file itself as edit actions |
| 11 | +with the VS GUI would cause the comments to get lost. |
| 12 | +Most of disabled rules\warning are based on the C++ Core Guidelines that require |
| 13 | +usage of the gsl helper library. |
| 14 | + |
| 15 | +## Warnings |
| 16 | + |
| 17 | +- C26426: Global initializer calls a non-constexpr function 'xxx' |
| 18 | +**Rationale**: many false warnings. CharLS is a library, globals are correctly initialized. |
5 | 19 |
|
6 |
| -C26429: Symbol 'xxx' is never tested for nullness, it can be marked as not_null (f.23). |
7 |
| --> Rationale: Prefast attributes are better. |
| 20 | +- C26429: Symbol 'xxx' is never tested for nullness, it can be marked as not_null (f.23). |
| 21 | +**Rationale**: Prefast attributes are better. |
8 | 22 |
|
9 |
| -C26446: Prefer to use gsl::at() instead of unchecked subscript operator. |
10 |
| - -> Rationale: CharLS require good performance, gsl:at() cannot be used. debug STL already checks. |
| 23 | +- C26446: Prefer to use gsl::at() instead of unchecked subscript operator. |
| 24 | + **Rationale**: CharLS require good performance, gsl:at() cannot be used. debug STL already checks. |
11 | 25 |
|
12 |
| -C26459: You called an STL function '' with a raw pointer parameter. Consider wrapping your range in a gsl::span and pass as a span iterator (stl.1) |
13 |
| -Rationale: gsl:span() cannot be used. Update to std:span when available (C++20). |
| 26 | +- C26459: You called an STL function '' with a raw pointer parameter. Consider wrapping your range in a gsl::span and pass as a span iterator (stl.1) |
| 27 | +**Rationale**: gsl:span() cannot be used. Update to std:span when available (C++20). |
14 | 28 |
|
15 |
| -C26472: Don't use static_cast for arithmetic conversions |
16 |
| - -> Rationale: can only be solved with gsl::narrow_cast |
| 29 | +- C26472: Don't use static_cast for arithmetic conversions |
| 30 | + **Rationale**: can only be solved with gsl::narrow_cast |
17 | 31 |
|
18 |
| -C26481: Do not pass an array as a single pointer. |
19 |
| --> Rationale: gsl::span is not available. |
| 32 | +- C26481: Do not pass an array as a single pointer. |
| 33 | +**Rationale**: gsl::span is not available. |
20 | 34 |
|
21 |
| -C26482: Only index into arrays using constant expressions. |
22 |
| --> Rationale: static analysis can verify access, std::array during runtime (debug) |
| 35 | +- C26482: Only index into arrays using constant expressions. |
| 36 | +**Rationale**: static analysis can verify access, std::array during runtime (debug) |
23 | 37 |
|
24 |
| -C26490: Don't use reinterpret_cast |
25 |
| --> Rationale: required to cast unsigned char\* to char\*. |
| 38 | +- C26490: Don't use reinterpret_cast |
| 39 | +**Rationale**: required to cast unsigned char\* to char\*. |
26 | 40 |
|
27 |
| -C26494: Variable 'x' is uninitialized. Always initialize an object |
28 |
| --> Rationale: many false warnings, other analyzers are better. |
| 41 | +- C26494: Variable 'x' is uninitialized. Always initialize an object |
| 42 | +**Rationale**: many false warnings, already covered with other analyzers. |
0 commit comments