[Openmcl-devel] :address ffi type spec

Gary Byers gb at clozure.com
Wed Aug 25 13:54:51 UTC 2004



On Wed, 25 Aug 2004, Marco Baringer wrote:

> Gary Byers <gb at clozure.com> writes:
>
> >
> > :ADDRESS is supposed to be shorthand for (:* :void); it doesn't make
> > sense to give :ADDRESS an argument, and I'd hope that something, somewhere
> > would complain about that.
>
> the docs suggest using (:* t), are these the same thing or are there
> times when i'd want one instead of the other? empricial evidence
> shows that (:* t) works fine for void *.
>

(:* t) and (:* :void) mean about the same thing, but they (currently)
don't map to exactly the same internal representation.  (I can't think
of a significant difference between those different internal
representations.)  Currently, (:* t) is roughly "pointer to nothing",
while (:* :void) is "pointer to :VOID, where :VOID is a foreign type
that you can't do much with except point to an 'instance' of it ...".

That distinction's pretty obscure; at the moment, I can't think of
a good reason for "pointer to nothing", and think that (:* t) should
be parsed as if it were (:* :void).   For all intents and purposes,
the two types are equivalent, but currently if you do:

? (def-foreign-type nil
     (:struct :x
              (:xptr (:* t))))

and later do:
? (def-foreign-type nil
      (:struct :x
               (:xptr (:* :void))))

you'll get a redefinition warning.  (This is about the only case I can
think of where anything would see (:* t) and (:* :void) as distinct;
they aren't effectively distinct, but differ enough in their
implementation details to confuse the code that issues the warning.)

To answer your question: I think that it'd be better for UFFI to use
(:* :VOID), and for (:* T) to be changed to be "exactly the same as
(:* :VOID)", instead of "semantically identical but implemented
differently", as it currently is.




More information about the Openmcl-devel mailing list