This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: struct interface


Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:

> I don't want to introduce complexity in the user interface.  One
> should be able to write things like:
> 
> struct foo {
>   char c;
>   SCM s;
> }

if you say the above to your C compiler, it'll align the `s' field.
in Scheme, if you say (vapor alert!):

(define-struct foo
  (c #:type <c-char>)
  (s #:type <scheme-object>))

then the machinery behind the macro will align `s' as well, or at
least I don't see why it shouldn't or why it would be hard.

so what do you mean by user interface?

> and rely on that this will work whatever architecture you're running
> on.

?

> If we require users to do explicit padding, I think this will become a
> common source of bugs.

yes.

> Also, I don't see any big reason why we couldn't support non-aligned
> SCM words.

it's probably no problem if they are untraceable by the GC (and they
are not really SCM's, just words).

-- 
Every program is a part of some other program and rarely fits.
                -- Alan Perlis

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]