Re: programming styles
Posted by Luigi Ballabio-3 on Dec 19, 2000; 4:47pm
URL: http://quantlib.414.s1.nabble.com/programming-styles-tp1631p1633.html
At 04:02 PM 12/19/00 +0100, you wrote:
>Hi everybody,
>Programming styles are probably one of the more contentious issues, and
>different people are used to different things. But I think Bernd is right to
>bring up the issue of programming style. There are probably a zillion ways
>of doing things, but what I would like to propose is that we should agree on
>a set of C++ programming style rules. This, I think, will avoid problems at
>a stage, when many more people are starting to add code.
Gilbert,
I agree with bringing up the issue. I had a look at the
recommendations you cited, and I agree with most of them. Actually, on
second thought, even with some that are against ones that I currently use -
and my colleagues know how grumpy I can get about these :) The only ones I
still have doubts about are:
5) Ok for having #defines in uppercase. I'd prefer enumerations inside
classes and static const class variables in mixed case starting with lower
case.
17) ok for employee.setName(). However, employee.getName() seems a bit
redundant to me - employee.name() is just as clear. Unfortunately this
would conflict with 6) since name() is not a verb (well, not in this case).
What the hey, you decide and tell me.
49) I would make an exception for static const variables, for which I see
no reason for access through a get() method.
69) I find an indentation of 4 more readable than 2. But hey, that's just
me, I can get used to it.
70) I like better example 1 for classes and functions too. But again,
that's just me.
83) f (x) looks very strange to me with the space in the middle. Then again...
90) We'll have to stick to /* ... */ when comments are to be extracted by
Doxygen.
Bye for now,
Luigi