>From: "danielm" <danielm@aldec.com.pl> >Chapter about foreach loop defines that with such loop we may iterate over >dynamic arrays but it doesn't precise what should happend if size of such >array will change inside lthat oop. This was addressed in the proposal for Mantis 1306, which specified that the results are undefined in that case, and that invalid index values may be generated. Presumably an implementation would either evaluate the size after each iteration, or once before starting the loop for efficiency. >Same about associative array what should happen if we add or remove some >entries from such table inside foreach. You are right that the LRM does not specify this. It could be inferred to be similarly undefined. Presumably an implementation would use the built-in methods to perform the iteration. So an entry added before the current entry would not be iterated over, but an entry added after it would. Removing an entry that is after the current entry would cause it not to be iterated over. Removing the current entry would prevent further iteration. Steven Sharp sharp@cadence.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri Jan 18 13:21:08 2008
This archive was generated by hypermail 2.1.8 : Fri Jan 18 2008 - 13:21:35 PST