Am Wednesday, 24. August 2011, 10:49:30 schrieben Sie: > Hi Graham, Carl, > > On Tue 23 Aug 2011 19:34:37 BST, Carl Sorensen wrote: > > On 8/23/11 12:21 PM, "ianhuli...@gmail.com" <ianhuli...@gmail.com> wrote: > >> Maybe we should have some GOP rules for C++ about this? > >> "Only have multiple exit points from routines if you absolutely have to.
There is really not much difference in if (some_condition) return; and if (!some_condition) { .... } Except that if you have many conditions the indentation in the second example will be terrible and make the whole thing hard to read. You can mess up equally with both. > Declaring variables nearest to where they are used + insisting they are > initialised may work, providing we spell it out the if they are > declared as parameters to the routine, that's the first place they're > used, so if they're output parameters, they need to be initialized > either at the top of the routine, or in the parameter declaration. Please note that in this case we are talking about a function that is expected to modify its arguments, this is NOT about variable declarations. These variables, passed-by-reference, should be initialized as soon as possible. For variable declarations, of course I'm all for moving the declaration immediately before the first use. Cheers, Reinhold -- ------------------------------------------------------------------ Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/ * Financial & Actuarial Math., Vienna Univ. of Technology, Austria * http://www.fam.tuwien.ac.at/, DVR: 0005886 * LilyPond, Music typesetting, http://www.lilypond.org _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel