Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gnucap:manual:tech:rangeloop [2022/11/25 01:40] (current)
felixs created
Line 1: Line 1:
 +It could be good, or not.
  
 +One point about it is that this form does not explicitly specify the
 +order of the iteration.  Therefore I would only use it in cases where
 +that is the intent, and even in that case, explicitly specify the type.
 +
 +<code>
 +int main() {
 +  int numberArray[] = {
 +    100,
 +    200,
 +    300,
 +    400,
 +    500
 +  };
 +  for (int number: numberArray) {
 +    cout << number << " ";
 +  }
 +  return 0;
 +}
 +</code>
 +
 +prints: 100 200 300 400 500
 +....  or does it?
 +why not: 300 200 500 400 100
 +....  ?
 +
 +We really need a loop like this, or better yet .. one that supports
 +parallel operation.  This would have been a good place to introduce it.
gnucap/manual/tech/rangeloop.txt · Last modified: 2022/11/25 01:40 by felixs
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki