Hacker News new | past | comments | ask | show | jobs | submit login

I'm SO glad Zed has pointed this out! I dislike code like this and I dislike it even more when people say K&R style is the best, it's classic, believe/follow the creators of the language!

Fu that.

It's error prone, just like Zed says. Add braces, don't be lazy, it makes the code flow easier on the eye.

IMO, In JS, it's painfully dangerous to be "too" clever as well.

Sometimes I like to think about it like so: Will someone else "with less skill than me" be able to follow this code after me? Then again, being human I sometimes fail to think this way :(.




The overly clever argument is only valid if you think the point of K&R is to teach good programming style. In fact it's to teach you to read and write C programs. In many cases the learning point is achieved by the reader puzzling out why the code works and learning from this.

Complaining that this isn't easy enough is missing the point.

Arguing that the language shouldn't allow such constructs is again outside the scope of the argument. K&R designed the language, so presumably they agree with the design.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: