guile-user
[Top][All Lists]
Advanced

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

Re: smobs


From: Marius Vollmer
Subject: Re: smobs
Date: 13 May 2003 19:51:19 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"Dr. Peter Ivanyi" <address@hidden> writes:

> 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);
> }

Yes, you can do that.  You need to return 0 in your smob free routine
then.

[ BTW: The memory management for smobs will be much nicer in the 1.8
  series of Guile. ]

> Moreover with the above example every time the function is called
> "tt" will be created on the stack. Will guile see it properly?

Since "tt" does not hold a SCM object (it is just an "int"), Guile
does not need to see it.  

> Will the stack be maintained correctly?  Does that mean that unless
> my integer object is released that stack is growing?

I don't understand.  "tt" is a totally ordinary local C variable that
behaves like any other local C variable.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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