Re: C argument type for indices?
Tom Lord <lord-1tv/[email protected]> Wed, 4 Feb 2004 12:39:39 -0800 (PST)
| Newsgroups | gmane.lisp.scheme.pika.devel |
|---|---|
| Message-ID | <[email protected]> |
> From: Andreas Rottmann <[email protected]>
> Tom Lord <lord-1tv/[email protected]> writes:
> > (`int' is fine for the number of limbs and limb indexes -- just not
> > for elt offsets into limbs. `int' is similarly fine for vtable-object
> > slot indexes.)
> So I guess you want t_uint for elt offsets into limbs?
No, ssize_t.
The rule is:
* signed integers for indexes -- mostly so that functions
can return either a valid index or -1.
* ssize_t for indexes of things that are of indefinate size --
such as limb elements
* int for indexes for things that are guaranteed small in number
-- such as vtable object slots and vtable limbs
* t_scm_fixnum for hash values -- which aren't indexes but which we
want to give to and get back from Scheme as fixnums, not bignums
-t