[gmx-developers] GROMACS C++ coding style

Berk Hess hess at kth.se
Thu Feb 21 10:39:37 CET 2013

On 02/21/2013 10:17 AM, David van der Spoel wrote:
> On 2013-02-20 22:52, Mark Abraham wrote:
>> Hi devs,
>> It occurred to some of us today that we should pick a C++ coding style
>> now before things advance too far. Berk, Teemu and Mark in
>> http://redmine.gromacs.org/issues/845 got as far as agreeing that they
>> don't care too much about a particular style, except that it should use
>> spacing that enhances code readability, and be readily supported in
>> common editors (emacs, vi, Eclipse, anything else?). Ideally, without
>> needing custom configuration of such editors.
>> Is there anyone who already has a good reason for supporting / vetoing
>> particular styles?
>> Also, any remaining emacs magic lines will disappear at some point soon.
>> Mark
> This is indeed useful. However it would be immensely helpful to have 
> something like emacs magic lines to help maintain a certain style. If 
> these are to disappear, HOW will it be enforced? I noted e.g. that a 
> lot of Teemu's code has a "non-standard" indentation where
> namespace gmx {
> does not cause indentation of the underlying code (e.g. class 
> definitions). I don't mind this, but if such an indentation pattern 
> can not be automated it will be difficult to keep it.
Anything can be automated in emacs.
M-x c-set-style stroustrup
gets things about right for C code, except that this does not match the 
"case" indentation of uncrustify.
I would guess it should be quite close as well for C++.
We can easily customize the emacs settings, and put in on the wiki, or 
change our standard.
I don't mind have the Gromacs style default for C++ in my emacs.



More information about the gromacs.org_gmx-developers mailing list