News for hackers. Stuff that matters.
Re:C++ pitfalls by blablabla123 on Wednesday November 28, 2012 @10:39AM (#4843020)
I remember being extremely cautious the last time I used std::map...

Anyways, g++ -Weffc++ -Wall helps, eventhough not in this case I think ;)

Re:C++ pitfalls by npsimons on Wednesday November 28, 2012 @11:06AM (#4843186)
Start 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.
Re:C++ pitfalls by zem on Wednesday November 28, 2012 @06:08PM (#4845327)
wow, 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-weff...