Christian Stimming wrote:
Am Donnerstag, 13. August 2009 22:56 schrieb Tim Abell:
Late to the party, but currently I prefer tab indents to spaces as it
allows each developer to decide for themselves how big the indent is.

I'm afraid I don't agree to this one. Things like multi-line function declarations (or multi-line statements):

some_function_name(char *arg1,
                                     char *arg2,
                                     char *arg3);

Usually we expect all three "char *" parts to be horizontally aligned. To achieve this, the indentation for the subsequent arguments must be done using spaces, as otherwise the column where the second argument is shown changes arbitrarily depending on the tab size of your currently used editor. In other words, no, a variable tab size is not a solution but will instead cause you new problems. Either you must decide on a fixed tab size, or we must use spaces. I'd stick with the spaces because of this.

Regards,

Christian
Christian,

Thank you for your clear explanation, which is very much appreciated. I'll add some more background on my current practice.

Just to be clear, I'm not attempting to influence the standards for gnucash or to persuade you of my methods, I simply find the conversation interesting. I appreciate you sharing your views as it helps broaden my understanding of differing and equally valid approaches.

Your explanation neatly explains why we differ in opinion :-)

I personally don't use or particularly like reading multi-line function declarations, so the example you showed has never caused me personally any discomfort.

Where I do use hard wraps mid-statement in my code, I usually indent subsequent parts to the level of the next line plus one extra indent and don't worry too much about whether it lines up with its parent line. If I did wrap function declarations I would probably apply the same practice.

eg:

void foo(var connection)
{
[tab]   var sqlcmd = new sqlcmd("select blah
[tab]   [tab]  from blah
[tab]   [tab]  where blah", connection);
[tab]   sqlcmd.run();
}

The reason I like this is that when I'm scanning a large section of code, I'm not too worried about the relationship between "select" and "from" beyond "from" and "where" being part of the declaration of sqlcmd, I'm merely looking to see which lines are in the same function / control of flow sections as each other. When looking in detail at the above statement it is still trivial for me to see the relationship between the "select", "from" and "where" even though they are not perfectly aligned.

As you may have gathered my perspective comes from working mostly with C#, and I have not done large amounts of C so don't have experience of what works best in C.

Thanks again for taking the time to explain, and feeding my thirst for common understanding.

Yours

Tim Abell

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to