Question about (double *)NULL



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?

--
Rouben Rostamian
.



Relevant Pages

  • Re: int a[5] .. difference between a and &a
    ... int main{ ... Invoking undefined behaviour can give any result whatsoever. ... And what lesson will the OP draw from your apparent condoning of the cast ... void main can set your house on fire. ...
    (comp.lang.c)
  • Re: print an address
    ... cast into (void*) and print using %p identifier rather than %u, ... even if unsigned int (the type expected for "%u" and int* happen to ... I don't think anyone has explained why the cast is ... On many implementations, different pointer types have ...
    (comp.lang.c)
  • Re: what different between 1 and 2, why?
    ... If your compiler didn't warn you about the implicit or missing ... int main ... Again, drop the unnecessary cast. ... the standard guarantees that void* and char* ...
    (comp.lang.c)
  • Re: void *
    ... list_add_head(&p, (int *)100); ... That was my understanding of 'void *' concept. ... In fact at your level the first thing you should assume when you appear to need a cast is that you have done something wrong and a cast is *not* the solution. ... Personally I don't think you understand the concept of pointers yet, so you need to read the sections of your text book and the comp.lang.c FAQ that refer to pointers. ...
    (comp.lang.c)
  • Re: Pointer dereference rather than sizeof?
    ... there is no pointer type that requires a cast ... when a (void *) type value is being assigned to it. ... int main ... int *ptr; ...
    (comp.lang.c)