The loops associated with a loop-associated directive have canonical loop form if they conform to the following:
for (init-expr; test-expr; incr-expr) structured-block
| |
init-expr | One of the following: |
var = lb | |
integer-type var = lb | |
random-access-iterator-type var = lb | |
pointer-type var = lb | |
test-expr | One of the following: |
var relational-op b | |
b relational-op var | |
incr-expr | One of the following: |
++var | |
var++ | |
- - var | |
var - - | |
var += incr | |
var - = incr | |
var = var + incr | |
var = incr + var | |
var = var - incr | |
var | One of the following: |
A variable of a signed or unsigned integer type. | |
For C++, a variable of a random access iterator type. | |
For C, a variable of a pointer type. | |
This variable must not be modified during the execution of the for-loop other than in incr-expr. | |
relational-op | One of the following: |
< | |
<= | |
> | |
>= | |
!= | |
lb and b | Expressions of a type compatible with the type of var that are loop invariant with respect to the outermost associated loop or are one of the following (where var-outer, a1, and a2 have a type compatible with the type of var, var-outer is var from an outer associated loop, and a1 and a2 are loop invariant integer expressions with respect to the outermost loop): |
var-outer | |
var-outer + a2 | |
a2 + var-outer | |
var-outer - a2 | |
a2 - var-outer | |
a1 * var-outer | |
a1 * var-outer + a2 | |
a2 + a1 * var-outer | |
a1 * var-outer - a2 | |
a2 - a1 * var-outer | |
var-outer * a1 | |
var-outer * a1 + a2 | |
a2 + var-outer * a1 | |
var-outer * a1 - a2 | |
a2 - var-outer * a1 | |
incr | An integer expression that is loop invariant with respect to the outermost associated loop. |