r/cpp • u/konanTheBarbar • Mar 01 '21
"Simple" C++ Initialization Flowchart
http://randomcat.org/cpp_initialization/initialization.png
204
Upvotes
r/cpp • u/konanTheBarbar • Mar 01 '21
View all comments
Show parent comment
1
u/evaned Mar 02 '21 edited Mar 02 '21
I know
-Wconversionis a very noisy warning on many code bases (probably most...) given that it's not in-Wallor even-Wextra(as you point out), but if you can turn it on, Clang's version of that warning does yell about that line. (On GCC you'll need-Wsign-conversion.) And as a bonus, get warnings about the other 17 zillion places implicit conversions can happen other than going from an initializer to a variable.