yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11079
Re: [Branch ~yade-pkg/yade/git-trunk] Rev 4087: Fix compilation. (for latter reference regarding coding style)
On 17/07/14 13:29, Anton Gladky wrote:
> 2014-07-17 13:04 GMT+02:00 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>:
>> Or even (to an extreme), in one line:
>> if ( valPropres[0] > std::max(valPropres[1],valPropres[2]) )
>> {whereSigI=0; whereSigII=valPropres[1]>valPropres[2]? 1 : 2; whereSigII=
>> valPropres[1]>valPropres[2]? 2 : 1}
> I would personally escape this particular style. It is difficult
> to read it.
I agree. It was an extreme.
So maybe a minimal consensus that we could put somewhere in the doc
could be: braces styles 1,2,3,4 depending on what's inside the braces.
In addition:
* indent, and indent consistently, spaces OR tabs in the same file (I
would like tabs everywhere but not all editors can do that automaticaly
and maybe no consensus on this), if spaces at least four for each
indentation level
* don't run autoformating and don't re-indent large blocks if not the
main author of one file, and if you really do so make a special commit
stating explicitely that it is a formatting commit.
1*If a block has a single statement, no braces:
if () doSomething;
else somethingElse;
2*if multiple but very short statements:
if () {a=1; b=2; c=3;}
3*for more complex blocks:
if (){
longStatement1;
longStatement2;}
4*for even longer blocks:
if ()
{
longStatement1;
...
longStatementN;
}
5* avoid closing brackets on the same line:
if () {
for () {
}}
Comments?
B
Follow ups
References