Topic: Variable scope in loops.


Author: artyom@kansmen.com (Art Shelest)
Date: 1996/06/13
Raw View
I noticed that my compiler rejects the following construct.

do
{
   int x;
   //...
}
while( x > 0 );

I don't know if this is valid C++ or not, but wouldn't it make sense to extend
variable scope in do...while loops? I think it would be in the spirit of

for( int x = 0 ; ...)
{
   // use x
}


   _Art.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]