On Tue, Jun 29, 2004 at 08:11:41PM -0400, Paul Tsai said
> Joris Huizer wrote:
> 
> >
> >The worst thing I know of Visual C++ is,
> >
> >for (int i = 0; .... )
> >  ...
> >...
> >...
> >for (int i = 0; .... )
> >
> is the bad thing the declaration of int in the for loop?  According to 
> scoping rules i  is only in scope for the first for loop so the second 
> declaration should be ok.  It's been a while since I used VC++ but is 
> the issue the fact that MS has the scoping rules messed up (i.e. the 
> second for loop prompts an error)? 

That indeed was the problem: the "int i" declaration was considered to
be out of the loop scope, and thus declared twice in the same scope (the
function).  Ick.  I found a short discussion here:
http://www.mvps.org/vcfaq/lang/1.htm.  I do believe it has been fixed in
recentish versions of VC++, though.

-- 
Words of the day:        CID Capricorn CIDA Commecen Adriatic spies clandestine

Attachment: signature.asc
Description: Digital signature

Reply via email to