lilypond-devel
[Top][All Lists]
Advanced

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

Re: Uninitialized SCM variables


From: Reinhold Kainhofer
Subject: Re: Uninitialized SCM variables
Date: Wed, 17 Aug 2011 13:59:24 +0200
User-agent: KMail/1.13.6 (Linux/2.6.38-10-generic; KDE/4.7.0; i686; ; )

Am Wednesday, 17. August 2011, 13:53:40 schrieb Carl Sorensen:
> \On 8/16/11 10:25 PM, "Dan Eble" <address@hidden> wrote:
> > Is there a reason that these variables in lily/profile.cc don't need to
> > be initialized?  I don't have experience with guile, but it looks
> > dangerous.
> > 
> > SCM context_property_lookup_table;
> > SCM grob_property_lookup_table;
> > SCM prob_property_lookup_table;
> 
> I guess the code in this section relies on the fact that the compiler will
> initialize the unitialized value to zero.   Do you believe that is a
> problem?

Note that this is also the assumption on the !cached, even if changed to use 
SCM_UNPACK:

SCM cached;
if (!SCM_UNPACK (cached)) ...

where SCM_UNPACK is defined in /usr/include/libguile/tags.h to be either
   #define SCM_UNPACK(x) (x)
or
   #define SCM_UNPACK(x) ((x).n.n)

In both cases, the check is whether an uninitialized variable is 0...

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



reply via email to

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