lilypond-devel
[Top][All Lists]
Advanced

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

Re: for_UP_and_DOWN


From: David Kastrup
Subject: Re: for_UP_and_DOWN
Date: Sun, 15 Apr 2012 16:49:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Łukasz Czerwiński <address@hidden> writes:

> The final suggestion depends on suggestions from all of you. If you
> find a better idea for (UP_and_DOWN(d)), I'll do so. If you find
> easier: for_UP_and_DOWN, it could be this.

I find for_UP_and_DOWN somewhat more consistent, but syntax-aware
editors (and indenters) don't share my sentinent.  So using that will be
rather boorish.

The C++ way would be to use iterators here.  Something like

use std;

const vector <Direction> up_and_down { UP, DOWN };

for (vector<Direction>::iterator d = up_and_down.cbegin ();
     d != up_and_down.cend(); ++d) {
    [Do something with *d]
}

> I'd like to write code, that will make Lilypond better or easier to be
> used

Not necessarily the same as "the C++ way".

> and it's not my goal to fulfill my ambitions to force unwanted
> changes, so:
>
> 1) As Graham and Keith wanted for(UP_and_DOWN), the macro and example
> is:
>
> #define UP_and_DOWN(d) \
> Direction d = UP; d != CENTER; flip(&d), d == UP ? d = CENTER : d

That looks rather nonsensical.  Why use flip at all here, and what with
the obscure : d as a nop?  You could write

; d = d == UP ? DOWN : CENTER ;

-- 
David Kastrup



reply via email to

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