Il giorno ven, 20/03/2009 alle 15.44 +0800, PCMan ha scritto:
> Currently, coding style of all lxde programs were different.
> However it's good for a project to have consistent coding style in all
> the programs.
I am the "last-comer" in LXDE, I think, but I would like to contribute
with my opinion.
> Personally, my coding style is like this:
Mine is like this:
#include "some-header.h"
void function()
{
if ( value ) {
char str[10];
for ( i = 0; i < 10; ++i ) {
do_something();
str[i] = '0' + i;
}
str[i] = '\0';
} else if ( value2 ) {
do_other_things( param1, param2, param3 );
} else {
do_nothing();
}
}
> 1. use fixed 4 space indentation instead of tabs.
I use tabs for indentation (line start) and spaces for alignment:
int i;
char *s;
gint64 i2;
^ ^
tab spaces
> 2. do not attach { to end of line and put it in a seperate line.
I do, as above.
> 4. different words in a filename should be seperated by hyphen. (ex:
> main-window.c, not mainwindow.c)
The opposite :) but I am not strict. Sometimes I use main_window.c
> 5. add spaces between operaters and their operands.
Me too, but not strictly.
> 6. no space between function name and ().
Never cared, I just adapted my code for legibility case by case.
Generally I put a space after for, if, while, etc (language constructs),
but not after a function name.
> 7. add spaces between parameter list of a function and the () outside it.
Me too, but not strictly.
> If anyone found those rules quite annoying, I'm open for discussion.
I use tabs instead of spaces for indentation to match any taste. I
prefer 4-spaces tabs, someone else could prefer 8-spaces, others
2-spaces. This way anyone can have his config.
I prefer "inline braces" to save vertical space, and mainly because I am
used to it. Maybe I have been influenced by python on this.
Bye.
--
Alessandro Pellizzari
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list