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
You can have initialization statements inside if and switch since C++17.
if
switch
Your code would now be:
if (CThing* pThing = GetThing(); pThing->IsReallySomeThing()) { // use pThing here } // pThing is out of scope here