Ok, you have convinced me. Macros are bad. Let's just stick with the gotos, i.e.:
Status = NtXXX(); if( !NT_SUCCESS(Status) ) goto somecleanup;
Now if anyone can help me to customize emacs to auto paste the boilerplate if( !NT_SUCCSS line, maybe even with a DPRINT1 built into it, I'd appreciate it ;)
Anyhow, from now on I think everyone should try to use the goto method instead of duplicate cleanup blocks all over the place.
Alex Ionescu wrote:
Phillip Susi wrote:
I've been doing a bit of work on the usetup code and came to realize that we have a bit of a widespread problem in a lot of code. There is a great deal of code that looks basically like this pseudo code:
To everyone suggesting horrendous macro ideas (Filip, wake up!!! You haven't commented on this yet!), may I recommend the following read:
http://blogs.msdn.com/oldnewthing/archive/2005/01/06/347666.aspx
As well as Larry Osterman's "Hiding Complexity" and "Every programmer should know what assembly their code generates".
Best regards, Alex Ionescu