4 ms·
I break two of these all the time: minimize vertical space and define variables close to their use. I'm one of those people that prefer braces on their own min
by gavinhoward 3y ago
I break two of these all the time: minimize vertical space and define variables close to their use.
I'm one of those people that prefer braces on their own mine, even left braces.
But it works for me. Empty space actually helps me read my code more easily.
Likewise, in C, I define all variables at the top of a scope. This is dangerous in C because of the possibility of uninitialized data, but Clang catches everything. And I prefer it because Clang has a warning to enforce that style so that I can't mix styles. Also, using those variables becomes like using type inference in other languages; the first use looks like initialization without the type annotation.
Not that the author is wrong, but don't feel bad if you depart from this for your own personal stuff. And follow whatever style policy is required by your employer.