[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone on this list?



On Mon, 28 Oct 2002, Steve Baker wrote:

> 
> My TuxKart game required TWO lines of source code to be changed in order
> to run under Windoze.   Both of those were because the code was being 
> compiled under MSVC which has a problem with:
> 
>   {
>     for ( int i = ..... )
>     {
>     }
> 
>     for ( int i = ...... )
>     {
>     }
>   }
> 
> ...if it had been ported using CygWin, there would have been zero
> lines of code to change.
> 
> However, if you write a program under Windoze using DirectX, you have
> zero chance of it porting to anything else without major surgery.
> 
>

Hello,

Here is a "porting to MSVC" tip to solve this little issue.

If the old-style "for scope" is giving you problems in MSVC, instead of
reverting your code, there is an easy workaround.  Add this to a header:

#define for if (false) {} else for

Perverse, but it doesn't seem to have any ill consequences, and fixes the 
problem nicely.

<lurk> mode re-engaged...

-Xark