[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fix handling of grace notes to shorten preceding tied notes correctl
From: |
Keith OHara |
Subject: |
Re: fix handling of grace notes to shorten preceding tied notes correctly (issue 7108043) |
Date: |
Wed, 16 Jan 2013 05:21:33 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Benkő Pál <benko.pal <at> gmail.com> writes:
>
> 2013/1/15 <k-ohara5a5a <at> oco.net>:
> > https://codereview.appspot.com/7108043/diff/1/lily/include/audio-
item.hh#newcode90
> > lily/include/audio-item.hh:90: virtual string to_string () const;
> > It seems fine to have the debug-output helper to_string(), but why make
> > it a virtual member function? Unless the compiler is a lot smarter than
> > me, that would seem to require a pointer to the actual function be
> > stored in every Audio_note object. Then every user would need extra
> > memory for every note, but would get no benefit.
>
> no, pointer to the actual function is stored in a per-type (not
> per-object) table,
> the object stores a single pointer to the per-type function table,
> and that pointer is needed anyway for a type with virtual members.
> (btw I thought without checking that to_string is inherited from a
> (very low level) base and now I can't easily check whether it's
> really so - is it?)
>
Okay. The class 'Audio_note' is a sub-class of 'Audio_item', which has
virtual functions itself, so the cost of a v-table pointer is already paid.
In any case, one extra word per note is not *too* bad.