guile-devel
[Top][All Lists]
Advanced

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

Re: C Struct Interface


From: Andy Wingo
Subject: Re: C Struct Interface
Date: Tue, 13 Jul 2010 23:18:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hello,

On Mon 12 Jul 2010 04:20, Noah Lavine <address@hidden> writes:

> It seems from the code that scm_c_make_structv(vtable, ntail, ninit,
> inits) is the main function for creating structs. I'm assuming that
> ntail is the number of elements in the tail array of the struct

Yes. Avoid tail arrays if you can, they are confusing and a bad interface.

> ninit
> is the total number of elements I want to init, and inits is an array
> containing the initial values. Is this correct?

Yep. 

> Also, if I make a struct in this way, can I then do
> SCM_STRUCT_SLOT_REF(struct, n) to get at it, where n=0 is the first
> slot?

You can indeed, though this does no bounds checking.

Sorry for the undocumented state of things; patches to fix that most
welcome! ;)

Andy
-- 
http://wingolog.org/



reply via email to

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