More than one way to do it...
Posted Feb 9, 2008 21:08 UTC (Sat) by
im14u2c (subscriber, #5246)
In reply to:
More than one way to do it... by tjc
Parent article:
Interview: Mark "Markey" Kretschmann (Not the Gentoo Weekly News)
Surprised you didn't jump on the opportunity to point out that the latter two loops are flawed, in part because they aren't idiomatic... ;-)
I was actually making two points: The first is that allowing for many ways to approach a problem can be valuable, and second is that mindlessly straying from idioms makes it easy to make mistakes and harder for others to understand your code.
It's like goto: It is very easy to use it to turn your code into spaghetti. At the same time, it's probably a mistake to outright ban its use, as there are times when the alternative is less clear. (Escaping a nested loop comes to mind.)
(
Log in to post comments)