[plt-scheme] _double and _double*

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jun 8 23:40:26 EDT 2005

[replying anyway]

On Jun  8, Chihiro Kuraya wrote:
> I have a question about differences between _double and _double*
> ctypes.

_double corresponds to a Scheme floating point number, an inexact;
_double* will coerce any (real) Scheme number to a C couble.  This
should have been clear from:

>   Finally, there are two floating point types, _float and _double 
>   for the corresponding C types; and _double* that implicitly 
>   coerces any non-complex number to a C double.

so if something confused you, tell me what and I'll try to clarify.

> I looked source code for implementation of above.
> I found the followings in foreign.c .
> [...]

"foreign.c" is quite verbose in these parts -- and this particular
piece of code simply creates the Scheme objects, so it won't help.
You should look in foreign.ssc for a better view.

> It seems that Scheme to C conversion is the same 
> between _double and _double* .  

`_double*' uses the "real..." C stuff, which does the conversions.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.