🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Herb Sutter Tue, 26 Sep 1995 23:00
Re: Scope of variables declared in if/while/for
#2045
Author: Herb Sutter
Date: Tue, 26 Sep 1995 23:00
28 lines
1565 bytes
I wrote:
>surprises that used to be legal (e.g. you could have the lifetime and 
>scope of an object not end at the same time, and then there was some 
>weirdness introduced by the RTTI rules).

That last phrase is shoddy writing.  Instead of the sloppy (and wrong) "some 
weirdness introduced", Steve said much more clearly:

Steve Clamage wrote:
>3. With the addition of dynamic_cast, it became particularly desirable
>to have limited-scope variables defined in loop or selection statements:
>	if( T* p = dynamic_cast<T*>(e) { ... }
>	else if( U* p = dynamic_cast<U*>(e) { ... }
>A for-loop variable should then also have limited scope. This was the
>clincher.

Mea culpa!

Herb


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herb Sutter                 2228 Urwin, Ste 102         voice (416) 618-0184
Connected Object Solutions  Oakville ON Canada L6L 2T2    fax (905) 847-6019
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads