[petsc-dev] Problem with PETSC_NULL and variadic functions

Jed Brown jedbrown at mcs.anl.gov
Wed Nov 9 15:12:01 CST 2011


On Wed, Nov 9, 2011 at 15:04, Lisandro Dalcin <dalcinl at gmail.com> wrote:

> Yes, or just include stdlib.h and define to NULL.
>

NULL is in C89, but I know we have found systems where it was not defined,
otherwise we would just use NULL instead of PETSC_NULL everywhere. Is this
still the case, or just a historical mishap that _everyone_ has fixed?


> >     2) Can we at least fix it for C by using #define PETSC_NULL
>  ((void*) 0)  in C and using 0 in C++. After all nobody really uses PETSc
> from C++ :-)
> >
>
> actually, we could try to define PETS_NULL as "0" in 32bits and "0L"
> in 64bits (OS X, Linux)... For WinDog 64, this does not work, I do not
> remember if there is some way to specify literals for __in64 ...
> perhaps ((__in64)0) would do...
>

We already test for long long, so we have access to something equivalent to
uintptr_t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111109/2e8a43e2/attachment.html>


More information about the petsc-dev mailing list