8000 Update list of warnings for MSVC and GCC/clang · etem/cppbestpractices@ca6ab13 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca6ab13

Browse files
committed
Update list of warnings for MSVC and GCC/clang
1 parent 3858b94 commit ca6ab13

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

02-Use_the_Tools_Available.md

Lines changed: 28 additions & 4 deletions
703E
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,39 @@ You should use as many compilers as you can for your platform(s). Each compiler
8888
* `-Wunused` warn on anything being unused
8989
* `-Woverloaded-virtual` warn if you overload (not override) a virtual function
9090
* `-pedantic`
91+
* `-Wconversion` warn on type conversions that may lose data
92+
* `-Wsign-conversion` warn on sign conversions
93+
* `-Wmisleading-indentation` warn if identation implies blocks where blocks do not exist
94+
95+
Consider using `-Weverything` and disabling the few warnings you need to on Clang
96+
9197

9298
`-Weffc++` warning mode can be too noisy, but if it works for your project, use it also.
9399

94100
### MSVC
95101

96-
`/W4 /W44640`
97-
98-
* `/W4` - All reasonable warnings
99-
* `/w44640` - Enable warning on thread un-safe static member initialization
102+
`/W4 /W44640` - use these and consider the following
103+
104+
* `/W4` All reasonable warnings
105+
* [`/w14242`](https://msdn.microsoft.com/en-us/library/3hca13eh.aspx) 'identfier': conversion from 'type1' to 'type1', possible loss of data
106+
* [`/w14254`](https://msdn.microsoft.com/en-us/library/3fbf7w04.aspx) 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
107+
* [`/w14263`](https://msdn.microsoft.com/en-us/library/ay4h0tc9.aspx) 'function': member function does not override any base class virtual member function
108+
* [`/w14265`](https://msdn.microsoft.com/en-us/library/wzxffy8c.aspx) 'classname': class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly
109+
* [`/w14287`](https://msdn.microsoft.com/en-us/library/33s0was4.aspx) 'operator': unsigned/negative constant mismatch
110+
* [`/we4289`](https://msdn.microsoft.com/en-us/library/06d758c0.aspx) nonstandard extension used: 'variable': loop control variable declared in the for-loop is used outside the for-loop scope
111+
* [`/w14296`](https://msdn.microsoft.com/en-us/library/wz2y40yt.aspx) 'operator': expression is always 'boolean_value'
112+
* [`/w14311`](https://msdn.microsoft.com/en-us/library/4t91x2k5.aspx) 'variable': pointer truncation from 'type1' to 'type2'
113+
* [`/w14545`](https://msdn.microsoft.com/en-us/library/s2xatszb.aspx) expression before comma evaluates to a function which is missing an argument list
114+
* [`/w14546`](https://msdn.microsoft.com/en-us/library/7be2hd1z.aspx) function call before comma missing argument list
115+
* [`/w14547`](https://msdn.microsoft.com/en-us/library/y1724hsf.aspx) 'operator': operator before comma has no effect; expected operator with side-effect
116+
* [`/w14549`](https://msdn.microsoft.com/en-us/library/60yhzzeh.aspx) 'operator': operator before comma has no effect; did you intend 'operator'?
117+
* [`/w14555`](https://msdn.microsoft.com/en-us/library/k64a6he5.aspx) expression has no effect; expected expression with side-effect
118+
* [`/w14619`](https://msdn.microsoft.com/en-us/library/tacee08d.aspx) #pragma warning: there is no warning number 'number'
119+
* [`/w14640`](https://msdn.microsoft.com/en-us/library/4f5c8560.aspx) Enable warning on thread un-safe static member initialization
120+
* [`/w14826`](https://msdn.microsoft.com/en-us/library/ms235307.aspx) Conversion from 'type1' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
121+
* [`/w14905`](https://msdn.microsoft.com/en-us/library/zayh85yw.aspx) wide string literal cast to 'LPSTR'
122+
* [`/w14906`](https://msdn.microsoft.com/en-us/library/ae10z5cb.aspx) string literal cast to 'LPWSTR'
123+
* [`/w14928`](https://msdn.microsoft.com/en-us/library/cwck4ta9.aspx) illegal copy-initialization; more than one user-defined conversion has been implicitly applied
100124

101125
Not recommended
102126

0 commit comments

Comments
 (0)
0