So I noticed that we don’t say anything about initializer list formatting in
our coding style guide. I’d like to propose that we standardize this formatting:
Foo::Foo(int aBar, char aBaz)
: mBar(aBar)
, mBaz(aBaz)
{
….
}
In other words, we should list items in the initializer list one per line. Each
item should be indented two spaces, with the ‘:’ and each ‘,’ vertically
aligned and a space between the ‘:’/‘,’ and the initializer.
If the entire constructor declaration can fit on one line in 80 characters, we
could relax this rule. In other words, this seems reasonable to me:
Foo(int aBar) : mBar(aBar) { }
I suspect that none of this is controversial at all, since this is already the
defacto standard for newer code that I see written in much of the codebase. If
there’s a reasonable level of consensus, I’ll edit the coding style guide to
add this rule.
Thanks,
- Seth
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform