[Top][All Lists]

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

Re: Part_combine_iterator::derived_mark: don't abort marking prematurely

From: dak
Subject: Re: Part_combine_iterator::derived_mark: don't abort marking prematurely. (issue 6057044)
Date: Wed, 18 Apr 2012 04:39:20 +0000

Reviewers: Graham Percival,

On 2012/04/17 20:21:14, Graham Percival wrote:
LGTM and can be pushed right now.

But for my general ignorance: why not just hard-code 4?  I suppose
that using
the sizeof() trick makes it a bit safer in case somebody adds
something to ptrs,
but is there any other reason?

No.  It is just a common C idiom.  Personally, I think it would make
more sense to just unfold the loop.  Takes fewer lines and is clearer.

I just kept with the original style.

For an array-based style, an automatic array makes little sense over
explicit code.  One could instead use a static array with
pointers-to-member (basically offsets), and then dereference them. In
that case, a 0 entry would indeed work as an ending mark.

But for 4 entries?

Part_combine_iterator::derived_mark: don't abort marking prematurely.

Please review this at

Affected files:
  M lily/

Index: lily/
diff --git a/lily/ b/lily/
index eb1cca43e57092ed886f3166c6ae739d97c03970..5378aff4ecf405614aab7a9a978cca166193b90c 100644
--- a/lily/
+++ b/lily/
@@ -165,10 +165,9 @@ Part_combine_iterator::derived_mark () const
-    solo_one_event_,
-    0
+    solo_one_event_
-  for (int i = 0; ptrs[i]; i++)
+  for (vsize i = 0; i < sizeof (ptrs)/sizeof (*ptrs); i++)
     if (ptrs[i])
       scm_gc_mark (ptrs[i]->self_scm ());

reply via email to

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