Re: [GD-General] Variables scope
Brought to you by:
vexxed72
From: <ke...@ac...> - 2004-02-04 12:27:57
|
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" <Jor...@uz...> > 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, > |