Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ams6110
on Jan 5, 2013
|
parent
|
context
|
favorite
| on:
Deconstructing K&R C (2010)
If I'm intentionally writing a one-line if I will write it on one line. I think using an indented second line without braces is less clear, and more prone to problems later when the code is modified.
So I'd write:
if (max > 0) printf("%s", longest);
or
if (max > 0) { printf("%s", longest); }
but never
if (max > 0) printf("%s", longest);
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
So I'd write:
or but never