INN indentation

Julien ÉLIE julien at trigofacile.com
Sun Sep 19 13:29:15 UTC 2021


Hi Richard,

> The current stated style is, in hacking.pod:
> 
>    Use a roughly BSD indentation style but with four-space indents.  This
>    means no space before the parenthesis around function arguments, open
>    brace on the same line as if/while/for, and close and open brace on
>    the same line as else.
> 
> However the reality is slightly more complicated: many files use tabs 
> and spaces interchangeably, apparently with an assumption that the tab 
> character represents 8 spaces, despite the coding style saying indent is 
> 4 spaces.

Hmm yes, and I admit to be a bit faulty there because I have tabstop set 
at 8 in vim.  Source code seems to have initially written with 8-space 
indents.  See for instance innfeed/imap_connection.c where the first 
level of indentation is 4 spaces, and the second level is a tabulation. 
  That's why I then used to assume a tabulation represented 8 spaces 
when modifying existing code.

Regarding indentation, what has been done until now is always use spaces 
for new code, and convert tabs to spaces when modifying lines in 
existing code.


Note that some tabulations may still be needed in source code, 
especially outside indentation.  I have in mind control/docheckgroups 
which for instance contains:
   ${SED} 's/	[	]*/	/'
as \t appeared to be non portable in all sed implementations.

-- 
Julien ÉLIE

« La vie est un sommeil, l'amour en est le rêve et vous aurez vécu si
   vous avez aimé. » (Alfred de Musset)


More information about the inn-workers mailing list