3 ms·
I remember being extremely cautious the last time I used std::map... Anyways, g++ -Weffc++ -Wall helps, eventhough not in this case I think ;)
by blablabla123 14y ago
I remember being extremely cautious the last time I used std::map...
Anyways, g++ -Weffc++ -Wall helps, eventhough not in this case I think ;)
- npsimons 14y agoStart with "g++ --help=warnings | grep "\-W" | awk '{print $1}' | sort | uniq", sort out the ones that don't apply to C++, add in "-pedantic" and "-fdiagnostic-show-option", then (sparingly!) disable spurious warnings via the "GCC diagnostic ignored" pragma, or just outright removal of the warning option (the first candidate that comes to mind is -Waggregate-return). Do be aware that if you are using libraries which trigger warnings, you can turn off warning checking for them with "-isystem" (but make sure to also take "-Wsystem-header" out of your list of warnings). This won't prevent every gun pointed at foot incident, but it's a good start.
- zem 14y agowow, did not know about -Weffc++. quite impressive that they added that flag. here's a blog post if anyone else wants to read about it: http://cpptruths.blogspot.com/2006/08/g-compiler-option-weffc.html http://cpptruths.blogspot.com/2006/08/g-compiler-option-weff...