C++ problem (redone)
steve at bougerolle.net
Fri Aug 27 07:44:43 PDT 2004
On Fri, 2004-08-27 at 06:55, Jason Gurtz wrote:
> When emailing code inline, yes sometimes the lines are long and would be
> wrapped. I would say a minimum of 2 spaces for all indents (as above)
> and if it still doesn't fit at 72 chars then send as an attachment
> instead. I think most people would agree with me that 4 spaces is the
> "normal" indentation level.
That does seem to be normal. Personally I prefer one space per indent,
but I'm rare that way. There are a few out there who seem to like
whopping huge 8-character indents and acres of white space, too, but
thankfully not many as that makes code very hard to read.
> IMO, Another good practice is to initialize all variables to a known
> value. e.g.
This is arguable, although there are good reasons for doing it or not.
If you set them explicitly later on when you first use them then you
don't have to flip back and forth through your code to figure out what
the values are (and you run less risk of them changing without you
noticing). In C++ these arguments are irrelevant though, since there
are cases where you can't initialize variables (in class definitions)
and where they must be initialized (static/global), and other cases
where it's hard to avoid declaring your (object) variable in the middle
of the code anyway.
Steve Bougerolle <steveb at bougerolle.net>
More information about the lfs-chat