Łukasz Czerwiński <milimet...@gmail.com> 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 _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel