Posted by
Luigi Ballabio-3 on
Dec 20, 2000; 1:33pm
URL: http://quantlib.414.s1.nabble.com/Programming-styles-Feedback-tp1634p1636.html
Hi all,
At 11:58 AM 12/20/00 +0100, Gilbert Peffer wrote:
>36. This is currently in contradiction to some of the code in Quantlib. I
>myself are not too consistent in this particular style case. What do you
>think?
I'm not that consistent myself - mostly out of laziness. But we can move
the body of the methods outside the class definition. Of course they will
stay in the header file for them to be inlined. One forced exception are
template methods of a non-template class, which VC++ won't compile unless
they are declared inside the class.
An additional thought: not cluttering the header with such inlined bodies
is somehow less of an issue, as the Doxygen-generated documentation for the
class has a clearer layout than the header file itself...
>38. ...TABs should be avoided. Does anybody have an idea of the real impact
>the use of TABs can have?
Actually I though that inserting real tab characters instead of spaces
allowed people to set the indentation to the number they like without
conflicting with others... am I missing something obvious here?
>87. I would like to add a suggestion for function/subroutine definitions.
>For long argument lists (and for short ones as well), I prefer to stack the
>arguments
>
> runThisRoutine (int numNodes, // Number of nodes
> int numElements, // Number of elements
> double* coordinateSet, // Nodal coordinates
> int* connectivityList) { // Elements connectivites
> blah blah
> }
>
>so one can comment each of the arguments individually. Unless somebody has a
>strong objection about this (I guess it is a style choice one has to get
>used to) I wouldn't mind seeing it implemented in Quantlib
We might be forced to follow the Doxygen requirements here, if we want such
comments to be extracted and put into the documentation. The Doxygen
comment block would look like:
/*! \brief short description of the method
\param numNodes number of nodes
\param numElements number of elements
\param coordinateSet nodal coordinates
\param connectivityList elements connectivities
\return description of the returned value
*/
double runThisRoutine (int numNodes, int numElements,
double* coordinateSet, int* connectivityList) {
blah blah
}
Bye,
Luigi