From: Gunnar Dalsnes
And I think these macro's are a perfect
example of
Phillip's point. I have no idea how the flow of
control is without looking at the macro definitions.
Sure you do, if you try _reeeealy_ hard;-P
No, really, I don't <<without looking at the macro definitions>>. RETURN
sounds much like return, it is non-obvious that they're actually goto's to
CLEANUP. Ofcourse, I figured it out when you committed that stuff 3 weeks
ago, but when looking at it last night it was again non-obvious to me.
On the other hand, I had no problem whatsoever figuring out the macro-free
code that Nathan posted:
BOOL NtFunc()
{
BOOL bResult;
void *pPointer = NULL;
Lock();
if (Stuff)
{
bResult = FALSE;
goto cleanup;
}
....
bResult = TRUE;
cleanup:
if (pPointer)
free(pPointer);
Unlock(stuff);
DPRINT1("NtFunc returned %i\n", bResult);
return bResult;
}
2)Using gotos are much more ugly imo.
Oh, so goto's are acceptable if and only if you hide them out of sight?
Gé van Geldorp.