guile-user
[Top][All Lists]
Advanced

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

Re: smobs


From: Dr. Peter Ivanyi
Subject: Re: smobs
Date: Mon, 12 May 2003 13:45:23 +0100

Thanks for the answers. I found the bug and it was related to the
reported number of allocations. However now I have a related question.

What should I do if my smob is simply an integer (immediate type)? 
Do I have to allocate it or I can simply use it from the local
variable? Basically what confuses me is, that I do not fully understand
what guile will do with an integer if it is passed as a smob. 
For example is this correct:

static scm_t_bits data_tag = 0;

static SCM make_my_data(SCM scm_data)
{
  int tt;

  SCM_ASSERT(SCM_INUM(scm_data), ...);

  tt = SCM_INUM(scm_data);
  
  SCM_RETURN_NEWSMOB(data_tag, tt);
}


or I have to allocate the integer and pass that to guile. Moreover
with the above example every time the function is called "tt" will be
created on the stack. Will guile see it properly? Will the stack be
maintained correctly? Does that mean that unless my integer object
is released that stack is growing?

Thanks for your help,

                                Peter Ivanyi




reply via email to

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