Indenting code?

Jim Graham james.graham at oracle.com
Fri Sep 14 22:22:31 UTC 2012


I think tabs and spaces at ends of lines are fine rules for automated 
enforcement, but the rest of the formatting guidelines are guidelines, 
not rules.  They are intended to make the code more readable as a whole 
by promoting consistency, but their individual mandates aren't always 
100% the best technique.  I'd say that 99.9% of the code I write could 
follow the guidelines just fine, but there are some cases where I play 
with indentation or combining or splitting lines to highlight the 
parallel nature or similarities of several lines of code (this probably 
comes up more in graphics where you deal with x,y and r,g,b,a 
computations that are all mostly identical than in more generic code).

In contrast, I'm not sure I know of any code that requires tabs or 
spaces at the ends of lines to look good or be readable/maintainable...

			...jim

On 9/14/12 1:51 PM, Kelly O'Hair wrote:
>
> On Sep 14, 2012, at 1:30 PM, Phil Race wrote:
>
>> On 9/14/2012 12:34 PM, Kelly O'Hair wrote:
>>> If we had a well defined formatter tool that we told people they must use, I suppose jcheck could enforce it's use
>>> by refusing any changeset where the source hasn't been "properly" formatted.
>>> But getting a whole bunch of different tools to do the same formatting? That seems like an exercise in futility.
>>>
>>
>> Although I suppose we already do this for the tabs and extra spaces at the end of lines for jcheck,
>> we also need to remember all the 3rd party code we have and the pain that would be when we
>> update it. I like to make zero to few changes to such code and live with their preferences - even
>> those that irk me.
>>
>> -phil.
>
> A very valid point, we would need to know which files we would enforce these rules, and that could be
> very tricky.
>
> Seems like we have lots of better things to do and maybe this just needs to be visited each time a source
> file or set of sources gets a major change.
>
> -kto



More information about the discuss mailing list