Foreach Access Violation
BCS
ao at pathlink.com
Tue Oct 21 11:28:37 PDT 2008
Reply to Chris,
> BCS wrote:
>
>> IIRC the docs say is it illegal to alter the loop array inside of a
>> foreach
>>
> Hmm, I wonder if it would be possible to make the loop array's length
> constant (immutable, whatever we're using today) in the loop so as to
> catch the bug at compile time. At my current state of unenlightened
> thinking I don't think it'd be necessarily hard to do - but I'm not
> in-the-know, so I'm just bouncing an idea around.
>
To many corner cases. To many ways to get around it. Also The spec forbids
altering /whatever/ is being looped over inside the loop. That includes using
opApply.
More information about the Digitalmars-d
mailing list