[tuxdroid-user] Fwd: Re: PATCH: For new coding style
Status: Beta
Brought to you by:
ks156
From: David B. <da...@ja...> - 2007-03-12 12:10:53
|
Thanks Henrik, Do other people have problems posting on the list? For those who never posted, just give us your opinion so you'll know if it works or not. ------- Forwarded message ------- From: "Henrik Grindal Bakken" <hg...@if...> To: da...@ja... Subject: Re: [tuxdroid-user] PATCH: For new coding style Date: Mon, 12 Mar 2007 13:05:22 +0100 "David Bourgeois" <da...@ja...> writes: Since you asked for opinions... I emailed this to you directly (hope you didn't get two copies now...), because either the sourceforge mail server or my work mail server refused me to post to the list. > In these guidelines, I was surprised to see that you prefer flower > braces on a new line (#2). That's the way I personally like it but > when looking at various guidelines I saw that most of the time they > prefer and recommend the more compact use #1 instead. I'm just > concerned many coders will prefer #1. What do you think? > > #1: > if (test) { > // do something > } > > #2: > if (test) > { > // do something > } Personally, at least, I prefer #1. > Another point, functions seems to be declared that way: > > type > my_function ( > type arg1, > type arg2, > ) > { > // body > } > > while another common way is > > type my_function (type arg1, type arg2) > { > // body > } I prefer #2 here (actually, I prefer to have the opening brace on the same line as well, but that's not too common, I think). I think the best argument for #2 is that it helps grepping. If a function has many arguments, one can always do type func(type arg1, type arg2, ... type argn) { } I prefer having return type on the same line as the function name no matter how one place the arguments. Using doxygen to document arguments is a better solution than per-argument comments anyway, IMHO. Hopefully the tuxen will arrive soon. Then I guess I have to have a look at the code myself too :) |