[Insight-developers] more VC++ idiosyncrasies
Luis Ibanez
ibanez@cs.unc.edu
Mon, 04 Dec 2000 15:34:25 -0500
Another way to get around the
for( int i ... )
VC++ redeclaration problem is to enclose
the "for" in brackets.
You can put brackets anywhere, and
create a local scope for variables.
That even helps for optimization and debugging.
something like:
{ // begin additional bracket
// any variable defined here has local block scope
for( int i=0; i<n; i++) {
....
}
} // closing additional bracket, end of block scope
{ // begin second additional bracket
// any variable defined here has local block scope
for(int i=0; i<n; i++)
{
...
}
} // closing second additional bracket, end of block scope
Which finally reflects the fact that both for's
are locally concerned and that you're not counting
on both "i" variables to be the same.
..., it isn't pretty either, but, it is a fast solution,
specially when this is not your own code. :-)
------
Luis
--
______________________________________________________________________
Luis Ibanez
Research Assistant Professor - Division of Neurosurgery
University of North Carolina at Chapel Hill
CB# 7060, Chapel Hill, NC 27599
email : ibanez@cs.unc.edu home : http://www.cs.unc.edu/~ibanez
phone : (919)-843-9961 fax : (919)-966-6627
______________________________________________________________________