[GRASS-dev] GRASS 7 development started

Glynn Clements glynn at gclements.plus.com
Mon May 5 01:10:03 EDT 2008


Hamish wrote:

> FWIW this is how those rules differ from what is currently given in the
> SUBMITTING file and what is at
> http://grass.osgeo.org/wiki/Development#Explanation_of_C_indentation_rules
> 
> --- submitting  2008-04-29 09:45:35.000000000 +1200
> +++ glynn       2008-04-29 09:45:47.000000000 +1200

> - -bli1

This one really has to change; it's quite common for editors to only
offer a choice of whether or not to indent by one "step". So if you
normally indent by 4 columns for each block, braces are either
indented by 4 columns or not indented at all.

> FWIW I prefer to put { on the same line as the if/for/while as it
> tightens up the code vertically. But that is just my personal preference.

Right; I tend to prefer quite a lot of whitespace, probably more than
most people. 

> As far as -cs, -saf, -sai, -saw for space after if,for,while etc. I
> prefer not to have that, to me those statements are like f(x), ie one is
> an argument for the other not a separate idea. In a similar way to how
> "G_some_fn ();" looks bad; just because if/for/while happen to be inbuilt
> fns doesn't matter.

If/for/while/etc aren't functions; that's one of the main reasons I
prefer a space in that case, to distinguish them from function calls.

E.g. searching for "\>(" (end-of-word marker immediately followed by
left parenthesis) finds function calls without also catching the test
expression of an if/while/for/switch statement.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list