Re: Variables scope

Kristoffer Grönlund <[email protected]>
Newsgroups gmane.games.devel.general
Message-ID <005601c3eb1e$0278e710$0da9ac51@hades>
The way I've worked around this in the past has been by redefining for as
follows:
#define for if (false) {} else for

Yes, it's a hideously ugly hack, but so is the problem in the first place.
I've never had any problems because of it.

// Kristoffer

From: "Jorrit Tyberghein" <[email protected]>
> CAVEY GERARD wrote:
>
> >Hi there
> >
> >Few days ago i switched to Visual c++ 6.0 and this is what i discovered.
> >The compiler accept the following C++ code :
> >
> >//first loop
> > for(unsigned long b=0;b<MeshesArray[current].VerticesCount;b++)
> > {
> > ...//processing
> > }
> >//second loop
> > for( b=0;b<not_used*3;b++)
> > {
> > ...
> > }
> >
> >But i thiink i should write the second FOR like this "for(unsigned long
> >b=0;b<not_used*3;b++)" (i mean i should redeclare 'b' because it came out
of
> >scope)
> >When i tried the compiler answered me "error redefinition ..." !!!
> >Did i forget to set an option ;it is a bit strange isn t it?
> >
> >Greetings
> >GC
> >
> >
>
> The best way to avoid this bug in VC 6 is to put 'unsigned long b'
> before the first
> loop like this:
>
>     unsigned long b;
>     for (b = 0 ; ...)
>     ...
>     for (b = 0 ; ...)
>
> We had the same problem in Crystal Space.
>
> Greetings,
>



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=557
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.