[DUG] for..loop

Myles Penlington myles at ams.co.nz
Tue Aug 7 15:28:07 NZST 2007


I think what they mean is that the compiler can change between versions,
hence the value may change. 
The important issue is that Codegear makes no warranties as to the value
on exit from the loop. If they decided to trash the value due to the way
the registers are used, it could have any value.

The value could change depending on the code optimisations used (or
between $O+ and $O- for that matter). 
In fact the last value used may not be stored anywhere, can't say I've
has cause to recently look at the code emitted in this case.

Myles.

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Ross Levis
Sent: Tuesday, 7 August 2007 03:22
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] for..loop

Why does the Delphi help say that a For loop variable has an undefined
value
after the loop finishes it's iterations?  Surely the variable is always
1
greater than the maximum "To" value.  That is what appears to happen in
all
situations I've tested.  I often use this test after a For loop to tell
if
something was not found.  What would cause a different result than this?

Cheers,
Ross.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe

Attention:
This communication is confidential and may be legally privileged.  If you are not the intended recipient, please do not use, disclose, copy or distribute it, other than to return it to us with your confirmation that it has been deleted from your system.



More information about the Delphi mailing list