Previous Thread  Next Thread

chat icon Consistant style?

cessen

Posted: Tue Oct 15, 2002 10:48 pm
Joined: 15 Oct 2002
Posts: 154
I think it would make sense to require a specific coding/commenting format that everyone must follow. It would make reading the code a whole lot easier.

I would write up some guidelines, but I'm afraid that I'd probably get flamed with things like "What kind of insane code format is that?!" Wink

I anyone wants any ideas, feel free to take a look at my PIE article (hopefully soon to be "articles"). http://www.brunslo.com/cessen/pie/pie.php
Reply with quote


xitnalta

Posted: Wed Oct 16, 2002 12:26 am
Joined: 15 Oct 2002
Posts: 68
There should be a CodingStyle directory (or CodingStyleGuide - or ... .html) somewhere in the documentation stuff to be released together with the source code. Maybe we still have to wait a few days for the documentation to come, but there will be a paper on coding style.

I'm happy that it contains instructions on how to get Emacs working with it - since a tab stop is normally at 8 spaces, not at 3 ...

I hope the doc. committee will have some influence on it, since documentation depends on source code and coding style.
Reply with quote


EWLloyd

Posted: Wed Oct 16, 2002 4:40 am
Joined: 16 Oct 2002
Posts: 2
After the coding standards are settled, what's needed is an astyle configuration file included in the source tree that implements the accepted style. All patches should be astyled against that file before diffing or checkin.

This way, if a specific developer has a particular coding style that makes it easier for him to work, he can astyle the files he's working on into his own personal style. That way, he can work "in the zone" without the jarring distraction of a style he's not used to. Then he can astyle them back to standard when he's done.

It'll also help to clean up any current inconsistencies in the code -- as each file is visited, it's brought up to standard as a matter of course.
Reply with quote


xitnalta

Posted: Wed Oct 16, 2002 7:35 pm
Joined: 15 Oct 2002
Posts: 68
If you had provided a link, I wouldn't have had to search it by using google. Hey, that's a hypertext medium, so use it's abilities to provide links and don't waste my time! (I'm actually not very angry about this, just make sure what you write is easy to read and explore (using links).)

astyle: http://sourceforge.net/projects/astyle/

What I immediately thought about when I saw your post was GNU Indent: http://www.gnu.org/software/indent/ . There's also some script in the Linux kernel that uses indent to reformat C code to comply to the coding guidelines of Linux development. I think I even saw a version of Indent for C++ once, but don't know for sure.
_________________
Felix
Reply with quote


EWLloyd

Posted: Thu Oct 17, 2002 12:35 am
Joined: 16 Oct 2002
Posts: 2
Quote:
If you had provided a link, I wouldn't have had to search it by using google. Hey, that's a hypertext medium, so use it's abilities to provide links and don't waste my time! (I'm actually not very angry about this, just make sure what you write is easy to read and explore (using links).)

Oops! My bad! Embarassed

It would be great to have a script to automate the process. As you noted, GNU Indent doesn't support C++, and generally isn't as fresh or flexible as astyle, which is much more actively maintained.

We'd also need to ensure that a user wouldn't need astyle just to build the application. It should only be needed by active developers.
Reply with quote


noid

Posted: Thu Oct 17, 2002 10:28 am
Joined: 16 Oct 2002
Posts: 5
There's no need to argue about tabs sizes. Everybody knows that indentation should be excactly 8 spaces wide ;-)
Reply with quote


madprof

Posted: Thu Oct 17, 2002 12:33 pm
Joined: 16 Oct 2002
Posts: 17
From what I have seen of the blender code, tabs are done with the TAB character, not with spaces, which means that you can set whatevr text-editor you like to display it at whatever side you want, and not need to do re-formatting at all.

MadProf
Reply with quote


xitnalta

Posted: Thu Oct 17, 2002 7:03 pm
Joined: 15 Oct 2002
Posts: 68
noid: At the conference, I saw (at the coding style roundtable) that the former NaN coding guidelines included indentation using tabs, and each tab stop being 3 spaces wide. Also, there was a restriction that lines be no wider than 80 spaces (expanding a tab to 3 spaces) wide (I would even restrict that to about 72).

For anybody really interested: you might want to ask Hans Lambermont for a copy of the guidelines. (He was one of the guys presenting them at the conference.) It might not yet be for general publication, but at least you could see what was discussed at the conference.

PS: Of course I know that at least for Unix systems, a tab stop is at every 8 characters.
_________________
Felix
Reply with quote


Sonarman

Posted: Sat Oct 19, 2002 4:00 am
Joined: 16 Oct 2002
Posts: 11
cessen:

Dude! That PIE article was great! I think that it's a really god idea, and I'll definetely be using it when I'm working on a big project. I can't wait for the next article!
Reply with quote


voidptr

Posted: Mon Oct 21, 2002 4:02 am
Joined: 14 Oct 2002
Posts: 21
I've posted a recommendation into the documentation thread based on the contents of this thread

http://www.blender.org/modules.php?op=modload&name=phpBB2&file=viewtopic&t=194

voidptr
Reply with quote


jeotero

Posted: Mon Oct 21, 2002 6:35 pm
Joined: 16 Oct 2002
Posts: 107
Smile

http://www.blender.org/modules/documentation/intranet/conventions/index.html
Reply with quote


jeotero

Posted: Mon Oct 21, 2002 6:39 pm
Joined: 16 Oct 2002
Posts: 107
PIE !
Reply with quote


cessen

Posted: Tue Oct 22, 2002 5:19 pm
Joined: 15 Oct 2002
Posts: 154
Well, the Blender documentation has now been released, and it includes coding style guidelines! So, I guess this thread is rather moot, now. Smile

Everyone should follow the style guidelines!
Reply with quote


kaktuswasser

Posted: Tue Oct 22, 2002 6:52 pm
Joined: 16 Oct 2002
Posts: 50
btw: pie can be combined with the style guidelines,or not?

cya henrik
Reply with quote


cessen

Posted: Thu Oct 24, 2002 10:38 pm
Joined: 15 Oct 2002
Posts: 154
Quote:
btw: pie can be combined with the style guidelines,or not?


Yes, they can. PIE is specifically meant not to be code-style-specific. PIE is a programming technique, rather than a code-style (the style used in the article was merely my coding style at the time... it has since changed somewhat). However, the technique does entail some implicit requirements--such as function headers (and the information in them)--simply because of the nature of the programming technique.
Reply with quote


Goto page 1, 2  Next
 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group