Is It Safe to Return C Pointer in Fixnum?

Hi,

Is it safe to return a C pointer from an extension to the user by using
INT2FIX (ptr) and then later retrieve it back using FIX2INT if the user
passes it back?

Or should I use INT2NUM and NUM2INT when I am dealing with C pointers
instead?

Regards,

Bill

Hi,

···

In message “Is It Safe to Return C Pointer in Fixnum?” on 02/08/06, William Djaja Tjokroaminata billtj@z.glue.umd.edu writes:

Is it safe to return a C pointer from an extension to the user by using
INT2FIX (ptr) and then later retrieve it back using FIX2INT if the user
passes it back?

Or should I use INT2NUM and NUM2INT when I am dealing with C pointers
instead?

Fixnum only preserves 31 bits, so that it is safe to use NUM2INT().

						matz.