[ODE] Simple macro trick to fix the compile problem with msvc 6
Sébastien Duval
Sébastien Duval
Tue Jan 14 14:00:01 2003
This is a multi-part message in MIME format.
------=_NextPart_000_003A_01C2BBE7.41AECF10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi, I've been using ODE for some time now and there is one detail which =
has bugged me since then.
I'm using Microsoft Visual C++ 6.0 (and I can't use another compiler). =
As most of you probably know, Visual C++ does not support redefinition =
of the same variable within multiple for loops at the same scope.
e.g. This won't compile.
for ( int i =3D 0; i < 5; i ++ )
{
// Do whatever...
}
for ( int i =3D 10; i < 35; i ++ )
{
// Do something else...
}
The problem is this limitation/bug doesn't occur on many compilers and I =
guess Russel is not using msvc 6.=20
The result is that certain demos don't compile. (For instance =
test_collision.cpp line 158, 197, 203.)
I propose to add a simple macro in ode.h
#ifdef MSVC
#define for if (0) {} else for
#endif
This way, for loops will be in a seperate scopes.
My two cents,
S=E9bastien Duval, Insane Logics
------=_NextPart_000_003A_01C2BBE7.41AECF10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>Hi, I've been using ODE for some time =
now and there=20
is one detail which has bugged me since then.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm using Microsoft Visual C++ 6.0 (and =
I can't use=20
another compiler). As most of you probably know, Visual C++ does not =
support=20
redefinition of the same variable within multiple for loops at the same=20
scope.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>e.g. This won't compile.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>for ( int i =3D 0; i < 5; i =
++=20
)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>{</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> // Do=20
whatever...</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>}</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>for ( int i =3D 10; i < 35; =
i ++=20
)</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>{</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> // Do =
something=20
else...</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The problem is this limitation/bug =
doesn't occur on many compilers and I guess Russel is not using =
msvc 6.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The result is that certain demos =
don't=20
compile. (For instance test_collision.cpp line 158, 197, =
203.)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I propose to add a simple macro in=20
ode.h</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>#ifdef MSVC<BR>#define =
for if (0) {}=20
else for<BR>#endif</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This way, for loops will be in a =
seperate=20
scopes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>My two cents,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>S=E9bastien Duval, Insane=20
Logics</FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_003A_01C2BBE7.41AECF10--