In C++ you can initialize a variable in an if statement, like so:
if (CThing* pThing = GetThing()) { }
Why would one consider this bad or g
One reason I don't normally do that is because of the common bug from a missed '=' in a conditional test. I use lint with the error/warnings set to catch those. It will then yell about all assignments inside conditionals.