[mythtv] C++ style

John P. Poet john at BlueSkyTours.com
Wed Feb 11 12:30:08 EST 2004


On Tue, 10 Feb 2004, Doug Larrick wrote:

> One quick comment... the prevalent brace style in MythTV is for an open
> brace to be on its own new line, even with the preceding statement.
> You will find your patches much more likely to be accepted w/o grumbles
> if you follow this convention... in fact, there are a few places
> (hdtvrecorder.cpp in particular) where you have changed the style of
> existing code as you modified it.  This introduces unnecessary
> differences in your patches and makes them harder to follow.
>
> -Doug

But I agree with Daniel's style! ;-) I also personally only use a 2 space
indent, rather than 4.  I, however, will bow to the style that Isaac has
designated.

Have you ever read any of Scott Meyers books: "Effetive C++" or "More
Effective C++"?  He has some great tips in those books.

For example, he says to always use pre-decrement/increment instead of
post-decrement/increment -- when possible.  The "pre" versions can be
converted into more efficient assembly language code, than the "post"
versions.  The only time you should use the "post" version, is when you
really need the increment/decrement to happend after the *current* value of
the variable has been used in the expression.


John







More information about the mythtv-dev mailing list