[Fwd: Re: new mpfr release]

Vincent Lefevre vincent+gmp at vinc17.org
Thu Sep 25 17:19:37 CEST 2003

On 2003-09-25 16:07:19 +0200, Torbjorn Granlund wrote:
> A properly declared NULL should work in any context, I think.

Not necessarily: First the C standard says that NULL expands to an
implementation-defined null pointer constant (which is not necessarily
a pointer), and there exist implementations that define:

#define NULL 0

This is conform to the C standard.

Then, if sizeof(void *) != sizeof(int) or if (void *) 0 and 0 don't
have the same memory representation (though this is not very common :),
you may have problems.

> But we would need to instruct people to #include stdlib.h
> before gmp.h in modern C, and stdio.h in classical C.

or #include <stddef.h>

> Defining NULL ourselves is no option.

I agree. However the documentation should mention the problem,
at least it should be clear about the accepted types.

Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

More information about the gmp-devel mailing list