2007/6/24, Anders Olofsson <[EMAIL PROTECTED]>:

Jon Keating wrote:
>   * Use Doxygen style comments for all function/class definitions. [1]

It shouldn't matter which way to write them but my vote is on /**,
mostly because that's the way I've already started commenting new
classes in the qt4-gui.

+1 on /**.

>   * When a bug is fixed, add comments to the changed code and reference the
> bug number.

Where it makes sense to add a reference, I'm all for it. But not to
every bugfix.

* Comments should normally reside on their own lines, example:

Agree.

* Indentation in switch blocks should be described. As the 'case' lines
are only labels and not statements, some will not add an indentation
step for them but I think it improves readability.

Fine by me. Feel free to add it to the wiki :)

* Global variables should be mentioned. Add the usual text that they're
evil and then describe a naming convention (if we have any) for the rare
cases when they are used anyway.

The singleton pattern can be used in all places where we currently use
globals, so my vote is on banning globals.

* The usage of NULL vs. using 0 should be specified. I remember
discussing this in #licq and I think it should be specified which to
use. (I still say that NULL is a C constant and that 0 is that thing to
use in C++ but I can accept 0 if that's what everyone else wants to use.)

NULL for pointers, 0 for integers. (In gcc NULL is defined as a
special symbol and not 0. So besides making it clear that something is
a pointer, it can actually help catch mistakes. And, IIRC, the
upcoming c++ standard will actually introduce null as a keyword.)

* Specify whether the following is good or bad:
if (x) return;

Bad.

* Should we mention anything on how to compare booleans?
if (isCompleted())
if (!isRunning())

As above.

* Add a statement that code should give no compiler warnings. And it
might be helpful to describe how to handle unused parameters

int SomeClass::someFunction(int \* unusedParam1 *\, void* /*
unusedParam2 */)

Agree. But lets use /* instead of \* :)

// Erik

--
Erik Johansson
http://ejohansson.se/

Reply via email to