DMD 0.174 release

Stewart Gordon smjg_1998 at yahoo.com
Fri Nov 17 11:45:54 PST 2006


Walter Bright wrote:
> Stewart Gordon wrote:
>> Moreover, this whole way of putting things can lead one to wonder 
>> whether variables declared in the body are reinitialized each 
>> iteration....
> 
> Why? A declaration is just like an assignment statement. It is executed 
> when it appears. If it appears in a loop, it is executed each iteration 
> of that loop.

True in general, but....

- in general, a declaration such as

     int x;

doesn't look like an assignment statement

- the idea of the same variable being declared multiple times in the 
same instance of being in the same scope is alien to many

- there are also static local variables, which aren't reset each time


Moreover, your claim that the _body_ of a for loop doesn't create a 
scope would also mean that ScopeGuardStatements and scope (fka auto) 
object references within the body are not processed at the end of each 
iteration, but saved until the end of the whole for loop.  Absolutely 
not the behaviour I'm experiencing.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d-announce mailing list