Weird segmentation fault error

Vincent Lefevre vincent at vinc17.net
Tue Jan 10 15:01:41 CET 2012


On 2012-01-10 14:09:43 +0100, Paul Zimmermann wrote:
> > Could somebody point out the reason for the segfault error?
> 
>  -- Function: void mpf_inits (mpf_t X, ...)
>      Initialize a NULL-terminated list of `mpf_t' variables, and set
>                   ^^^^^^^^^^^^^^^

Warning! NULL is not sufficient. For instance,

#define NULL 0

is a valid definition, and if int is on 32 bits and pointers are
on 64 bits, you may have problems. Since the C standard also allows
the implementation to have different representations for pointers to
different types, it is safer to use a null pointer with the pointer
to mpf_t type.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list