[Date Prev][Date Next] [Chronological] [Thread] [Top]

tab-width 4 and line length < 80, please



A reminder:

The OpenLDAP source code uses tab-width 4 and generally lines < 80
chars.  Please commit code written the same way, except in files
that are already written with tab-width 8.

Some people have been committing with tab-width 8, so the code now
contains a mixture of tab-width 4 and 8, but it still mostly looks
better with the original setting.  Maybe we'll reformat the entire
source tree someday, but that's not happened yet.

To take a simple example, look at #defines and structs in ldap.h.  At
the top, someone has been using tab-width 8, but further down we get:


[Displayed with tab-width 8]

typedef struct ldapcontrol {
        char *                  ldctl_oid;                      /* numericoid of control */
        struct berval   ldctl_value;            /* encoded value of control */
        char                    ldctl_iscritical;       /* criticality */
} LDAPControl;


[Displayed with tab-width 4]

typedef struct ldapcontrol {
    char *          ldctl_oid;          /* numericoid of control */
    struct berval   ldctl_value;        /* encoded value of control */
    char            ldctl_iscritical;   /* criticality */
} LDAPControl;


One can write code which displays OK both ways, if anyone prefers that:

* Do not use tabs after non-whitespace.
  - Put comments above instead of to the right of code.
  - Do not line up variables in declarations, use a single space.

* Or: Align with with spaces instead of tabs.  But in that case,
  only align on lines that have the same indentation.  I.e. not
	if (foo)                /* hi there */
		bar();				/* ho there */

-- 
Hallvard