coding style

3 views
Skip to first unread message

Fathi Boudra

unread,
Jun 4, 2009, 2:53:33 PM6/4/09
to krusade...@googlegroups.com
Hi,

any objections against passing astyle to get uniform sources for Krusader ?
At the moment, we have _many_ different styles over the sources.

I would like to using kdelibs coding style as a script is already provided:
http://techbase.kde.org/Policies/Kdelibs_Coding_Style#Artistic_Style_.28astyle.29_automatic_code_formatting

As Csaba have committed his lister prototype ;), it could be a good timing to
do it right now.

thoughts ?

cheers,

Fathi

Karai Csaba

unread,
Jun 5, 2009, 12:56:56 AM6/5/09
to krusade...@googlegroups.com
Hi,

I've created screenshots of my kdevelop settings (based on the artistic
style). Please let me know if they are OK. The best would be to
autoformat every code before committing.

Once we have consent on the coding style it would be useful to put it
onto the webpage.

Thanks,

Csaba


Fathi Boudra írta:
format1.png
format2.png
format3.png
format4.png

Fathi Boudra

unread,
Jun 5, 2009, 2:43:15 AM6/5/09
to krusade...@googlegroups.com
Let's start from astyle kdelibs script (as it exists):

astyle \
--brackets=linux \
--convert-tabs \
--indent-labels \
--indent-preprocessor \
--indent=spaces=4
--one-line=keep-statements \
--pad=oper \
--unpad=paren \
`find -type f -name '*.cpp'` `find -type f -name '*.cc'` `find -type f -name '*.h'`

It can be added to ~/.astylerc

> I've created screenshots of my kdevelop settings (based on the artistic
> style). Please let me know if they are OK.

in "tab & brackets":
--indent=spaces=4 => use spaces: 4
--convert-tabs => check convert tabs
--brackets=linux => Linux style

in "indentation"
--indent-labels => check labels
--indent-preprocessor => check preprocessor

in "formatting"
--unpad=paren => check remove unnecessary spaces around parentheses
--pad=oper => check add spaces around operators
--one-line=keep-statements => check keep on-line statements

> The best would be to autoformat every code before committing.

if you use shell, you can script "astyle-krusader && svn commit".

> Once we have consent on the coding style it would be useful to put it
> onto the webpage.

right

cheers,

Fathi

Rafi Yanai

unread,
Jun 7, 2009, 4:18:18 AM6/7/09
to krusade...@googlegroups.com
--indent=spaces=4 => use spaces: 4

Please don't do that.... using spaces instead of tabs is sacrilege of the highest order...

Fathi Boudra

unread,
Jun 8, 2009, 3:19:08 AM6/8/09
to krusade...@googlegroups.com
> --indent=spaces=4 => use spaces: 4
>
> Please don't do that.... using spaces instead of tabs is sacrilege of the
> highest order...

I see it the other way, using tabs is awfull:
- difficult to read
- cannot indent parameters properly
- inconsistent with popular coding style (Qt, KDE, etc ...)

any other opinions on the spaces vs tabs indentations ?

Rafi Yanai

unread,
Jun 8, 2009, 3:36:51 AM6/8/09
to krusade...@googlegroups.com
It was a joke..
(Altough I personally am a TAB person)

Just try and google for "spaces vs tabs indentations" it's a fun read...
I personally believe in this one: http://www.iovene.com/tabs-vs-spaces-the-end-of-the-debate/

Fathi Boudra

unread,
Jun 8, 2009, 4:16:47 AM6/8/09
to krusade...@googlegroups.com
> It was a joke..
> (Altough I personally am a TAB person)

and was taken as you have intended, a joke :)

> Just try and google for "spaces vs tabs indentations" it's a fun read...

I've done it, right after reading your initial mail ;) yeah, very funny!
There's so much articles on the subject.
It's impossible to get a proper opinion as it's a taste question and
mostly a personal point of view.

> http://www.iovene.com/tabs-vs-spaces-the-end-of-the-debate/

nice one.
good point for people using tabs for indenting. alignment shoud use spaces.

Reply all
Reply to author
Forward
0 new messages