guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile struct members are not a good 1-1 match for c structs


From: Andy Wingo
Subject: Re: guile struct members are not a good 1-1 match for c structs
Date: Wed, 30 Apr 2014 09:24:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

On Wed 30 Apr 2014 03:51, Doug Evans <address@hidden> writes:

> While reading guile sources I happened across the implementation
> of struct scm_print_state.  ref: libguile/print.h
>
> It (tries to) map a C struct to a set of Guile struct fields:
> ref: SCM_PRINT_STATE_LAYOUT.

You know, I don't think I ever noticed that before.  Gross!  Structs
were originally (i.e., in 1995) designed to be able to do that but it
never really caught on, probably because people want structs with
members that have types and might not all be the same size.  BDW-GC is
much better at being able to just scm_gc_malloc a memory block and then
you treat it as whatever C struct type you like....

> I *could* be missing something, but I think my angst can be represented
> with the following question:
>
> Has anyone tried to use scm_print_state from Scheme as a Guile struct
> on a host with 64 bit words and 32 bit ints and 32 bit longs?

I don't think anyone ever uses scm_print_state from Scheme -- from a
practical matter.  It's not documented anywhere.  I didn't even know it
was a struct.  But it sure looks like it won't work at all!

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]