Re: [PATCH 1/3] Documentation: clarify indentation style for C preprocessor directives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Patrick Steinhardt <ps@xxxxxx> writes:
>
>> There has recently been some discussion around how C preprocessor
>> directives shall be indented [1]. This discussion was settled towards
>> indenting after the hash by two spaces [2]. Document it as such.
>
> It was settled to have space after and not before the hash, but I do
> not recall ever agreeing to two spaces.  I prefer to increment by 1
> for each level instead to keep the whole thing less distracting
> while carrying meaningful information.

Using the indentation consistently is a good thing I do not object
to.

Among our existing header and source files (excluding compat/ that
is full of borrowed sources), scanning output from

    $ git grep -e '#  *' '*.[ch]' ':!compat/'

tells me that

 - builtin/gc.c (3 lines)
 - git-compat-util.h (52 lines)
 - trace.c (2 lines)
 - wildmatch.c (6 lines)

use one space indent after '#' per level, while

 - hash.h (10 lines, inconsistently 2 uses 1 per level)
 - thread-utils.c (8 lines)

use two space indent after '#' per level.

In compat/ directory, only compat/nedmalloc uses 2-space indent.
There in the hierarchy are so many files we borrowed from GNU, whose
coding style sticks to one-space indent.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux