Weird segmentation fault error
daggillies at gmail.com
Tue Jan 10 15:38:15 CET 2012
It's a good idea from a point of code readability as well to
explicitly cast NULL pointers to the correct type.
On Tue, Jan 10, 2012 at 8:01 AM, 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
More information about the gmp-discuss