> Braces Are Free, Use Them<p>I disagree. Braces have a cognitive load, particularly if they're given whole lines to themselves. Which is easier to read,<p><pre><code> while ((len = getline(line, MAXLINE)) > 0)
if (len > max) {
max = len;
copy(longest, line);
}
if (max > 0) /* there was a line */
printf("%s", longest);
</code></pre>
or<p><pre><code> while ((len = getline(line, MAXLINE)) > 0)
{
if (len > max)
{
max = len;
copy(longest, line);
}
}
if (max > 0) /* there was a line */
{
printf("%s", longest);
}
</code></pre>
? Personally, I'd probably write it<p><pre><code> while ((len = getline(line, MAXLINE)) > 0)
if (len > max) {
max = len;
copy(longest, line);
}
if (max > 0) printf("%s", longest);
</code></pre>
. Consistent structural indenting makes it easy to see the boundaries of the control structures.