Is there a way to print a warning if you forget to declare in ctor initialization list a member POD? I'm looking through docs and can't find anything. g++-4.4 here.
If you want to warn about code that uses the uninitialized value of the variable in its own initializer, use the -Winit-self option. These warnings occur for individual uninitialized elements of structure, union or array variables as well as for variables that are uninitialized as a whole.
Warn about uninitialized variables that are initialized with themselves. Note this option can only be used with the -Wuninitialized option. This warning is enabled by -Wall in C++. This option controls warnings when a declaration does not specify a type.
These functions changed semantics in GCC 4.4. Warn whenever a function parameter is assigned to, but otherwise unused (aside from its declaration). To suppress this warning use the unused attribute (see Variable Attributes ). This warning is also enabled by -Wunused together with -Wextra .
To help detect accidental misuses of such arrays GCC issues warnings unless it can prove that the use is safe. See Common Variable Attributes . Warn for cases where adding an attribute may be beneficial.
You can enable -Weffc++
to get a heap of ridiculous warnings, including every single non-ctor-initialized member.
To check for actual UB, use valgrind.
You can use the option -Wuninitialized
(and also -Wall
).
However, It only warns if the Uninitialized type is being used.
Also, Ofcourse you can use other softwares like Valgrind and Cppcheck to determine Uninitialized types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With