For functions, letting an empty line after the first { seems stupid to me:
either you want a compact code, and you don't add a line, or you don't want
a compact code and you do it C-like, by putting the { in the empty line:
my_function (…) {
}
or
my_function (…)
{
}Lucas 2012/1/3 David Gomes <[email protected]> > > public int my_function(string var) { > > int rv = 0; // var declarations > > > > // code > > > > return rv; // return has empty line before it. > > } > > > var result = my_function("hi"); > > However, this is the Vala standard, and probably what we're adapting, it's > just better to keep things clean and readable with space before > parentheses, besides following the Vala standard, which is always a plus. > > public int my_function (string var) { > > int rv = 0; // var declarations > > // code > > return rv; // return has empty line before it. > } > > var result = my_function ("hi"); > > > On Tuesday, January 3, 2012, Pim Vullers wrote: > >> I agree with Scott. This is what I normally use, first declaration of >> the function and variables, then the body and conclude with the result. >> >> On 02-01-12 20:56, Scott Ringwelski wrote: >> > I prefer something like this: >> > >> > public int my_function(string var) { >> > int rv = 0; // var declarations >> > >> > // code >> > >> > return rv; // return has empty line before it. >> > } >> > >> > to call it: >> > var result = my_function("hi"); >> > >> > Having an empty line after the function declaration looks really odd to >> > me. I also prefer not space between the function name and params. >> > >> > What about function comments? I think function comments aren't really >> > necessary, except for the especially important ones or common ly used >> ones. >> > >> > On Mon, Jan 2, 2012 at 11:19 AM, David Gomes <[email protected] >> > <mailto:[email protected]>> wrote: >> > >> > Ideally, for me, I'd love: >> > >> > public int my_function () >> > { >> > //Code >> > } >> > >> > It's the best way because the parentheses are aligned, so I can see >> > where the function starts and where it ends. >> > >> > However, I know most of you don't like it, we'll have to choose >> > between these: (notice the empty line difference) >> > >> > void my_function () { >> > >> > //Code >> > } >> > >> > void my_function () { >> > //Code >> > } >> > >> > I prefer first because it makes code more organized when there are >> > lots of lines. Besides, we're already doing it in most of our code. >> > >> > http://goo.gl/l7a88 I'm also working on this. I decided I would do >> > this because I'm a coding style freak. Code needs to be perfect and >> > consistent along all of our applications. In fact, I can volunteer >> > to fix all the dirty code we have (it's boring, but I don't care, I >> > love doing it) in all our apps, but only after we have a coding >> > style defined. >> > >> > Which one do you prefer? Thanks, discuss, and don't forget to "Reply >> > to all". >> > >> > >> > -- >> > David Gomes >> > >> > -- >> > Mailing list: https://launchpad.net/~elementary-dev-community >> > Post to : [email protected] >> > <mailto:[email protected]> >> > Unsubscribe : https://launchpad.net/~elementary-dev-community >> > More help : https://help.launchpad.net/ListHelp >> > >> > >> > >> > >> > -- >> > Scott Ringwelski >> > 231-492-5380 >> > [email protected] <mailto:[email protected]> >> > >> > >> > >> >> >> -- >> Pim Vullers >> Heerstraat 29 / 5953 GE Reuver >> [email protected] >> > > > -- > David Gomes > > -- > Mailing list: https://launchpad.net/~elementary-dev-community > Post to : [email protected] > Unsubscribe : https://launchpad.net/~elementary-dev-community > More help : https://help.launchpad.net/ListHelp > >
-- Mailing list: https://launchpad.net/~elementary-dev-community Post to : [email protected] Unsubscribe : https://launchpad.net/~elementary-dev-community More help : https://help.launchpad.net/ListHelp

