|
Boost : |
Subject: Re: [boost] coding conventions
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-01-04 10:08:17
On Mon, Jan 4, 2010 at 7:27 AM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
>> PS Using 2 space indentation reduces the risk of running over
>> the 80 width, so is my preference.
>
> Some find two too small to visually align vertically, but four limits indentation depth, so we've used three for years. Â (Gasp! Â Yes, three isn't a power or multiple of two, but it works well.)
I have always been curious about that. To me it makes *no* sense to
use spaces for indentation. I always use tabs for indentation and
spaces for alignment, my reasoning is that you can set tabs to be any
size you want in your editor, one space if you wish even, and spaces
for alignment just makes sense, for example:
class myClass : public anotherClass
{
public:
float f_;
myClass(std::string s // assume we need to wrap due to being too long
,float f) // aligned with spaces after being tabbed equal to
the above line
:anotherClass(s) // indented with tabs
,f_(f)
{
// do stuff, two tabs
}
}
And I have just always done it that way, therefore if I view it in my
IDE (with 4-space tabs) it looks perfect, if I need to view it in
crappy windows notepad (with 8-space tabs), it still looks perfect,
and I can yet open it in another thing and set the tabs to 1-space to
make it easier to print, and I can compress and grow it as I wish, I
tend to prefer 4-space tabs for editing since it lets me eyes easily
follow scopes and such without taking too much space.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk