RE: [GD-Windows] Strict ANSI and <windows.h>
Brought to you by:
vexxed72
From: Grills, J. <jg...@so...> - 2002-11-03 20:34:53
|
My complaint about this technique is that I then have to disable warning C4127: conditional expression is constant, something I'm not willing to do. Anyone have a solution for that, but has no runtime impact? j -----Original Message----- From: Jon Watte [mailto:hp...@mi...] Sent: Sunday, November 03, 2002 12:13 PM To: gam...@li... Subject: RE: [GD-Windows] Strict ANSI and <windows.h> 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 |