My whitespace style

Giorgos Keramidas keramida at freebsd.org
Wed Apr 15 08:43:29 PDT 2009


On Wed, 15 Apr 2009 09:56:05 -0500, "Matthew D. Fuller" <fullermd at over-yonder.net> wrote:
> On Wed, Apr 15, 2009 at 10:20:08AM +0300 I heard the voice of
> Giorgos Keramidas, and lo! it spake thus:
>>
>>         switch (value) {
>>         case SOME_CONSTANT_NAME:            do_stuff_here();        break;
>>         case ANOTHER_CONSTANT_NAME:         do_some_other_stuff();  break;
>>         default:                            default_stuff();        break;
>>         }
>
>  ^^^^^^^^^                           ^^^^^^^^^
>   This is                              This is
>  indentation                          alignment
>
>
>> Composite structure initializations also use a style similar to
>> this, and will almost invariably end up looking horrendously
>> misformatted when TAB sizes are 'elastic', i.e.:
>
> Only if you abuse tabs for alignment.  Indentation is not alignment.
> It's a pity that the two get conflated and everybody ends up treating
> them the same, so that advocating tab indentation is read as
> advocating tab alignment (even by proponents of tab indentation).

True :)

Most of the stuff I see aligned this way falls in one of two styles:

  a) Code that uses spaces both for indentation and alignment.

  b) Code that uses TABs only for both.

The second sort of code is the one that ends up looking terrible when
someone configures their editor to use a non-standard TAB size :)



More information about the freebsd-chat mailing list