I have a local that's only used for the purposes of checking the result from another function and passing it on if it meets certain criteria. Most of the time, that criteria will never be met. Is there any way I can avoid this "extra" local?
I only have about 1MB of storage for my binary, and I have several thousand function calls that follow this pattern. I know it's a minor thing, but if there's a better pattern I'd love to know!
SomeDataType myclass::myFunction()
{
SomeDataType result; // do I really need this local???
// i need to check the result and pass it on if it meets a certain condition
result = doSomething();
if ( ! result ) {
return result;
}
// do other things here
...
// normal result of processing
return SomeDataType(whatever);
}