News for hackers. Stuff that matters.
Re:How to Land a Six-Figure Software Developer Job by neilc on Monday May 04, 2009 @10:42PM (#593503)
foo() might throw an exception, leaking "p". Stack allocation should probably be used instead of heap allocation here, anyway.
Re:How to Land a Six-Figure Software Developer Job by brl on Monday May 04, 2009 @10:50PM (#593515)
Thanks for reminding me why I'm never going anywhere near C++ ever again in my life.

Good answer though, I was stumped.

Re:How to Land a Six-Figure Software Developer Job by aminuit on Tuesday May 05, 2009 @02:08AM (#593725)
I totally missed it too. People are using this to bash C++ which is probably fair, but it's worth noting that lots of modern C++ folks default to using RAII pointer types (std::auto_ptr, boost::shared_ptr) to guard against these types of errors.
Re:How to Land a Six-Figure Software Developer Job by lacker on Tuesday May 05, 2009 @01:18AM (#593685)
Ugh. Good point though. Reminds me of why my company forbids the use of exceptions in C++ programming.