On Thu, Jan 13, 2011 at 10:19 AM, David Kastrup <[email protected]> wrote: > > Hi, > > in note-collision.cc I read the following: > > Direction d = UP; > do > { > vector<Grob*> &clashes (clash_groups[d]); > vector_sort (clashes, Note_column::shift_less); > } > while ((flip (&d)) != UP); > > Uh, is there any reason not to just write > > vector_sort (clash_groups[UP], Note_column::shift_less); > vector_sort (clash_groups[DOWN], Note_column::shift_less); > > I find it somewhat strange to make a loop for two simple function calls.
In this particular case it may not matter, but the while ((flip(&d) != UP) is a common idiom in the lilypond source code, and you should get used to it reading the source code. Overall, I prefer to have programmatic constructs (like this while loop) over unrolling loops by hand, and making symmetry of left/right and up/down explicit in this way. -- Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen _______________________________________________ lilypond-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-devel
