Example A.37.1c

The public comment period closed January 31, 2008. This forum is now locked (read only).
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Locked
bda
Posts: 6
Joined: Wed Nov 07, 2007 12:48 pm

Example A.37.1c

Post by bda »

Example A.37.1c makes no sense with respect to the usage of the two variables a and b. Either a comment should be added, that a and b only have values when used inside init(), or we need a different example, e.g.

Code: Select all

void init(int *a, int *b) {

    int r_a, r_b;

#pragma omp single copyprivate(x, y)
{
    scanf("%d %d %d %d", &r_a, &r_b, &x, &y);
} /* end of omp single */
    
    *a = r_a;
    *b = r_b;
}
The Fortran example is ok, since a and b can be assigned new values within init() and those values can be seen by the calling function.

Locked