From: Gunnar Dalsnes
Phillip Susi wrote:
I'd just like to chime in here with my
opinion. About a year ago I
had the idea of introducing macros for error handling instead of
explicit gotos. We had some discussion on the matter, and I read
several papers on the web, and came to agree that use of
macros that change flow control is anathma. It makes the code
completely unreadable and unmaintainable.
In win32k i use macros for flow control in the NtUser
syscalls (functionally like a try/finally block) where its
very important that some cleanup (release a lock) is always done:
BOOL NtFunc()
{
DECLARE_RETURN(BOOL);
Lock();
if (Stuff) RETURN(FALSE);
....
RETURN(TRUE);
CLEANUP:
Unlock(Stuff);
DPRINT1("NtFunc returned %i\n", _ret_);
END_CLEANUP;
}
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.
For you it's easy, you wrote them, but for the rest of us it is obfuscating.
I didn't like it when you introduced this stuff in win32k.
Gé van Geldorp.