J
jacob navia
Rouben Rostamian a écrit :
You are right. The only difference is that you waste code space in a
useless assignment, and that afterwards you write NULL in lowercase.
A
#define null NULL
would accomplish the same thing
Umfpack is a C library for computations dealing with sparse
matrices. Several examples in the User's Guide use a certain
cast that puzzles me. Here is an example.
The prototype of the function umfpack_di_symbolic() is:
int umfpack_di_symbolic
(
int n_row,
int n_col,
const int Ap [ ],
const int Ai [ ],
const double Ax [ ],
void **Symbolic,
const double Control [UMFPACK_CONTROL],
double Info [UMFPACK_INFO]
);
The header file umfpack.h has:
#define UMFPACK_CONTROL 20
Here is a sample usage:
int main (void)
{
double *null = (double *) NULL ;
...
(void) umfpack_di_symbolic (n, n, Ap, Ai, Ax, &Symbolic, null, null) ;
...
return (0) ;
}
(Code fragments are put here by "cut-and-paste"ing from the manual.)
My question is: Does the cast in (double *)NULL accomplish anything?
It seems to me that the call to umfpack_di_symbolic() equivalent to:
umfpack_di_symbolic (n, n, Ap, Ai, Ax, &Symbolic, NULL, NULL) ;
Comments?
You are right. The only difference is that you waste code space in a
useless assignment, and that afterwards you write NULL in lowercase.
A
#define null NULL
would accomplish the same thing