[Issue 10876] foreach and remove over associative array causes invalid data to appear
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 23 14:24:10 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10876
--- Comment #4 from hsteoh at quickfur.ath.cx 2013-08-23 14:24:07 PDT ---
The problem with trying to iterate over a container that's being modified at
the same time is that you can't guarantee much of anything. For example, you
could insert !is null checks, but what happens if removing the key causes the
AA to rehash itself (e.g., to optimize for space as the number of keys
shrinks)? Then your subsequent iteration will be completely screwed up.
Basically, such hacks can only work by relying on implementation details, which
are not guaranteed by the spec. IOW, it's undefined behaviour.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list