P99

◆ P99_PARALLEL_FOR

#define P99_PARALLEL_FOR   _Pragma(P99_PARALLEL_PRAGMA) for

Declare a for loop for which all iterations can be run independently and out of order.

This can be used syntactically exactly as the keyword for, except that the programmer asserts with this that the depending statement or block can be executed independently and out of order for all instances.

P99_PARALLEL_FOR (unsigned i = 0; i < limit; ++i) {
unsigned sum = a[i] + b[i];
a[i] *= sum;
}

The resulting code may then be parallelized and (if the platform supports this) multiple threads may be used to speed up the execution.

See also
P99_PARALLEL_PRAGMA for the conditions under which this will result in a parallel execution.

Definition at line 809 of file p99_for.h.