Is there any difference code-wise between:
int i = 0;
for ( i = 0 ; i < n ; i++ )
{
}
and
for ( int i = 0 ; i < n ; i++ )
{
}
Maybe if there are more loops and they all use the same index?
Also, is the first version equivalent to:
int i = 0;
for ( ; i < n ; i++ )
{
}
I know the optimizer should be smart enough to generate the same code at least, but is there theoretically any difference?
Ok so I figured out why we were using the index declaration outside the loop.
Apparently our solaris compiler will give a compilation error for code like:
The error is: