HOME
| OPENMP API Specification: Version 5.0 November 2018

2.1.6  Iterators

Iterators are identifiers that expand to multiple values in the clause on which they appear.

The syntax of the iterator modifier is as follows:  

 
iterator(iterators-definition)  

where iterators-definition is one of the following:  

 
iterator-specifier [, iterators-definition ]  

where iterator-specifier is one of the following:  

 
[ iterator-type ]  identifier = range-specification  

where:

SVG-Viewer needed.

In an iterator-specifier, if the iterator-type is not specified then the type of that iterator is of int type.

SVG-Viewer needed.

SVG-Viewer needed.

In an iterator-specifier, if the iterator-type is not specified then the type of that iterator is default integer.

SVG-Viewer needed.

In a range-specification, if the step is not specified its value is implicitly defined to be 1.

An iterator only exists in the context of the clause in which it appears. An iterator also hides all accessible symbols with the same name in the context of the clause.

The use of a variable in an expression that appears in the range-specification causes an implicit reference to the variable in all enclosing constructs.

SVG-Viewer needed.

The values of the iterator are the set of values i0, …, iN-1 where:

SVG-Viewer needed.

SVG-Viewer needed.

The values of the iterator are the set of values i1, …, iN where:

SVG-Viewer needed.

The set of values will be empty if no possible value complies with the conditions above.

For those clauses that contain expressions that contain iterator identifiers, the effect is as if the list item is instantiated within the clause for each value of the iterator in the set defined above, substituting each occurrence of the iterator identifier in the expression with the iterator value. If the set of values of the iterator is empty then the effect is as if the clause was not specified.

The behavior is unspecified if ij + step cannot be represented in iterator-type in any of the ij + step computations for any 0  j < N in C/C++ or 0 < j  N in Fortran.

Restrictions