[bind10-dev] [bikeshed] C++ indentation style
Shane Kerr
shane at isc.org
Fri Feb 18 14:48:44 UTC 2011
All,
On Thu, 2011-02-03 at 11:47 -0800, JINMEI Tatuya / 神明達哉 wrote:
> I've noticed that recent BIND 10 C++ code has a mixture of two
> different indentation styles for multi-line expressions:
> (traditional?) BSD style and BSD KNF style and (see
> http://en.wikipedia.org/wiki/Indent_style).
>
> 1. In the (traditional?) BSD style, continuing lines are aligned with
> the corresponding opening parenthesis:
>
> if (JS_DefineProperty(cx, o, "data",
> STRING_TO_JSVAL(JS_NewStringCopyN(cx, data, res)),
> NULL, NULL, JSPROP_ENUMERATE) != 0) {
>
> 2. In the KNF style, continuing lines always start at the same column,
> indented by the size of "soft tab":
>
> if (JS_DefineProperty(cx, o, "data",
> STRING_TO_JSVAL(JS_NewStringCopyN(cx, data, res)),
> NULL, NULL, JSPROP_ENUMERATE) != 0) {
I have consulted the oracles, and the gods have spoken:
We will use BSD style.
I have updated the style guideline page:
http://bind10.isc.org/wiki/CodingGuidelines#TabsIndentation
BTW, if you run out of space it may mean you are indenting too far and
should refactor, or maybe use a temporary variable. Compilers are
relatively good at optimizing them away as needed.
--
Shane
More information about the bind10-dev
mailing list