This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Making Guile slower
Mikael Djurfeldt wrote:
>
> Greg Harvey <Greg.Harvey@thezone.net> writes:
>
> > Consider this:
> >
> > SCM_NEWCELL(foo);
> > SCM_SETCDR(foo, scm_must_malloc(foo_size, s_make_foo));
> > SCM_SETCAR(foo, scm_tc16_foo);
>
> .. which should be written ...
>
> m = scm_must_malloc (foo_size, s_make_foo);
> SCM_NEWCELL (foo);
> SCM_SETCDR (foo, m);
> SCM_SETCAR (foo, scm_tc16_foo);
>
> Wouldn't it be a solution, then, to abstract away this idiom, e.g. as
> a macro, so that we both gain readability, safer code, and get the
> freedom still to choose an efficient from of the NEWCELL operation
> itself?
In cvs there is already SCM_NEWSMOB(foo, scm_tc16_foo, m)
and SCM_RETURN_NEWSMOB(scm_tc16_foo, m) for this purpose.
Regards,
Charbel.