Re: [GD-Windows] Strict ANSI and <windows.h>
Brought to you by:
vexxed72
From: Pierre T. <p.t...@wa...> - 2002-11-03 18:23:54
|
Just in case.. http://www.flipcode.com/cgi-bin/msg.cgi?showThread=Tip-MSVCFor&forum=totd&id =-1 > 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? > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 |