RE: [GD-Windows] Strict ANSI and <windows.h>
Brought to you by:
vexxed72
From: Jon W. <hp...@mi...> - 2002-11-03 18:14:16
|
I'm following up directly to the list because I think the question is very valid and the reasons need to be re-inforced. Poorly designed macros can lead to debugging nightmares. Identity of the original requester hidden (as I'm forwarding a private e-mail). 1) The compiler will optimize out the if() for sure in release mode, and even usually in debug mode. 2) The extra else is so that you won't be caught in a dangling else problem. Consider: if( something ) for( int i = 0; i < 3; ++i ) punt( i ); else destroy_the_world(); Cheers, / h+ > -----Original Message----- > Sent: Friday, November 01, 2002 9:17 PM > To: Jon Watte > Subject: Re: [GD-Windows] Strict ANSI and <windows.h> > > > > // work-around for brain-dead MSVC for scoping problem > > #define for if(0);else for > > I'm sure that there is a good reason for the else, but it isn't > clear to me > why that would be any different from > #define for if(1) for > > Also, will the compiler optimize the extra if away, or will this > run slower? > > > |