P99
|
◆ P99_ACALL
Pass a pointer to an N dimensional array ARR to a function. This is not supposed to be used directly but instead is for defining a macro interface to a function: #define dotproduct(VA, VB) \
dotproductFunc(P99_ACALL(VA, 1, double const), \
P99_ACALL(VB, 1, double const))
.
double Ar[5];
double Br[5];
.
double result = dotproduct(&Ar, &Br);
Here the expression with If the argument N is omitted it will default to 1, indicating that the array is just one dimensional. If N is greater than 1, a list of the N lengths in the first N dimensions of ARR is passed to the function call. TYPE can be omitted in which case no attempt to conform types will be made. Specifying TYPE is particularly helpful if the type is qualified, that is it has a To be more precise, the three argument form asserts that pointers to the elements of the matrix are assignment compatible to pointers of the indicated type. Then we do the cast to the pointer to matrix type that would otherwise be dangerous and could hide incompatibilities.
|