Heap objects are heap-allocated data pointed to by non-immediate
SCM value. The first word of the heap object should contain a
type code. The object may be any number of words in length, and is
generally scanned by the garbage collector for additional unless the
object was allocated using a “pointerless” allocation function.
You should generally not need these functions, unless you are
implementing a new data type, and thoroughly understand the code in
If you just want to allocate pairs, use
(scm_t_bits word_0, uint32_t n_words)¶
Allocate a new heap object containing n_words, and initialize the
first slot to word_0, and return a non-immediate
encoding a pointer to the object. Typically word_0 will contain
the type tag.
There are also deprecated but common variants of
use the term “cell” to indicate 2-word objects.
(scm_t_bits word_0, scm_t_bits word_1)¶
Allocate a new 2-word heap object, initialize the two slots with
word_0 and word_1, and return it. Just like calling
scm_words (word_0, 2), then initializing the second slot to
Note that word_0 and word_1 are of type
If you want to pass a
SCM object, you need to use
(scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3)¶
scm_cell, but allocates a 4-word heap object.