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.
Personally, my coding style 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.
2. do not attach { to end of line and put it in a seperate line.
3. do not indent { and }.
4. different words in a filename should be seperated by hyphen. (ex:
main-window.c, not mainwindow.c)
5. add spaces between operaters and their operands.
6. no space between function name and ().
7. add spaces between parameter list of a function and the () outside it.
Some rules are not strictly followed by me, either.
If anyone found those rules quite annoying, I'm open for discussion.
Anyways, we can use some formating tools such as astyle to reformat
all the source code.
Cheers!
On Wed, Mar 11, 2009 at 4:15 PM, Mario Behling <[email protected]> wrote:
> Hi PCMan,
>
> is there any document about coding styles for LXDE that we could
> publish in the wiki?
>
> Maybe publishing some infos from PCMan would be a good start.
>
> Ciao,
>
> Mario
>
>
> ---------- Forwarded message ----------
> From: Jürgen Hötzel <[email protected]>
> Date: Mon, Mar 9, 2009 at 2:19 AM
> Subject: Coding Style (was: Re: [Lxde-list] [Patch] fix compilation errors)
> To: Mario Behling <[email protected]>
> Cc: [email protected], [email protected]
>
>
> Hi Mario,
>
> On Sat, Mar 07, 2009 at 08:52:19AM +0800, Mario Behling wrote:
>> Dear Juergen,
>>
>> thank you very much for joining the LXDE project on sourceforge. As
>> you are already participating in the project for some time, you know
>> the design principles and ideas behind LXDE very well. So, you already
>> have commit access. Please check with other developers if you are
>> unsure about development decisions.
>
> I didn't find any hints about coding style. So I started an emacs
> c-style following PCMan's style:
>
> (defconst lxde-c-style
> '((c-tab-always-indent . t)
> (indent-tabs-mode nil)
> (c-basic-offset . 4)
> (c-offsets-alist . ((substatement-open . 0)))
> (c-hanging-braces-alist . ((substatement-open . (before)))))
> "LXDE Programming Style")
>
> Maybe it's a good idea to publish a document about coding style
> on the wiki/LXDE site?
>
>> I will be at Linuxtag in Berlin. We are planning a special track for
>> LXDE, but I dont know if we get it yet. Would you be interested to
>> have a presentation on LXDE in Arch?
>
> This sounds interesting! I hope i will not be short of time.
>
> Jürgen
>
------------------------------------------------------------------------------
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