-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Freitag, 4. Dezember 2009 18:24:01 schrieb Trevor Daniels:
> David Kastrup wrote Friday, December 04, 2009 4:24 PM
> 
> > I've unwrapped a bit of code of the form
> >
> > for (a;b;c) {
> >  if (condition)
> >    short something
> >  else {
> >    Large something
> >  }
> >  z
> > }
> >
> > into
> >
> > for (a;b;z,c) {
> >  if (condition) {
> >    short something
> >    continue;
> >  }
> >  Large something
> > }
> >
> > which helps a bit keeping track of what happens where.
> 
> I disagree.  Hiding the z in the iteration clause means
> it is likely to be overlooked.  Also the use of continue
> rather than else does not clarify the structure IMO.

+1

To me continue clauses are like goto statements. I try to avoid them whenever 
possible. Only in some extreme cases where I would get like 12-times indented 
code, then its better than else...

When reading some code long afterwards, it's quite easy to miss a continue or 
return (the two pathes of an if are indented and thus easy to spot) and then 
wonder why some statement apparently has no effect.

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFLGVnUTqjEwhXvPN0RAqovAKDS/7/q5S+2Zerx9vlTf2rh9QlYSgCgsDZt
tzSVasyeJMgyuH15Qy+aMeI=
=T+hB
-----END PGP SIGNATURE-----


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to