mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-04 05:41:33 +01:00
40 lines
1.4 KiB
TeX
40 lines
1.4 KiB
TeX
%\pagebreak
|
|
\begin{ccppspecific}[4ex]
|
|
\section{C/C++ Arrays in a \kcode{firstprivate} Clause}
|
|
\label{sec:carrays_fpriv}
|
|
\index{clauses!firstprivate@\kcode{firstprivate}}
|
|
\index{firstprivate clause@\kcode{firstprivate} clause!C/C++ arrays in}
|
|
|
|
The following example illustrates the size and value of list items of array or
|
|
pointer type in a \kcode{firstprivate} clause. The size of new list items is
|
|
based on the type of the corresponding original list item, as determined by the
|
|
base language.
|
|
|
|
In this example:
|
|
|
|
\begin{compactitem}
|
|
\item The type of \ucode{A} is array of two arrays of two \bcode{int}s.
|
|
|
|
\item The type of \ucode{B} is adjusted to pointer to array of \ucode{n}
|
|
\bcode{int}s, because it is a function parameter.
|
|
|
|
\item The type of \ucode{C} is adjusted to pointer to \bcode{int}, because
|
|
it is a function parameter.
|
|
|
|
\item The type of \ucode{D} is array of two arrays of two \bcode{int}s.
|
|
|
|
\item The type of \ucode{E} is array of \ucode{n} arrays of \ucode{n}
|
|
\bcode{int}s.
|
|
\end{compactitem}
|
|
|
|
Note that \ucode{B} and \ucode{E} involve variable length array types.
|
|
|
|
The new items of array type are initialized as if each integer element of the original
|
|
array is assigned to the corresponding element of the new array. Those of pointer
|
|
type are initialized as if by assignment from the original item to the new item.
|
|
|
|
\cnexample{carrays_fpriv}{1}
|
|
\end{ccppspecific}
|
|
|
|
|