Weird segmentation fault error

Sumeet sumeetsk at gmail.com
Tue Jan 10 15:49:29 CET 2012


@Paul:
Thanks! Your solution worked for me.

@Vincent:
Please could you elaborate a bit - give a short sample code for instance?
I'm new to C and GMP.

Thanks,
Sumeet.

On Tue, Jan 10, 2012 at 7:31 PM, Vincent Lefevre <vincent at vinc17.net> wrote:

> 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)
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss
>


More information about the gmp-discuss mailing list