The unofficial coding best practise and code formatting conventions for XBMC
chadoe
Team-XBMC Developer Joined: Nov 2003 Reputation: 0 Location: Home |
2004-08-19 18:44
Post: #11
goto is still a valid keyword? damn, i thought they banned it 36 years ago
Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. |
| find quote |
Nickman
Fan Joined: Oct 2003 Reputation: 0 Location: Sweden |
2004-08-19 19:51
Post: #12
(butcher @ aug. 19 2004,12:48 Wrote:now lets not go nuts nickman - you should only use goto if a while, for or if would cause significantly less clear code. i've used about 1 goto in the past 2 years of programming. they are definitely not something to be sprinkled into code all over the place.:lol: offcource. i only missused it because i could. i didn't mean that all should do it...
|
| find quote |
Nickman
Fan Joined: Oct 2003 Reputation: 0 Location: Sweden |
2004-08-19 19:51
Post: #13
(butcher @ aug. 19 2004,12:56 Wrote:actually, just checked xbmc - there's almost 100 uses of the keyword goto in the source, almost all mine.:thumbsup: :kickass: :thumbsup:
|
| find quote |
Bobbin007
Team-XBMC Developer Joined: Oct 2003 Reputation: 0 Location: Germany |
2004-08-19 20:59
Post: #14
(jmarshall @ aug. 18 2004,17:44 Wrote:3. indents, at four spaces. no tabstops.i'm currently using a tab size of 2 and an indent of 2. the code is readable with these settings. afaik, these where the settings when the project began. greets bobbin007 Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. ![]() |
| find quote |
jmarshall
Team-XBMC Developer Posts: 24,523 Joined: Oct 2003 Reputation: 138 |
2004-08-19 21:21
Post: #15
thanks bobbin007.
seeing as that is the second vote for 2 space tabs, i've updated accordingly. agreed that the code is easier to read with these settings. Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. ![]() |
| find quote |
Bobbin007
Team-XBMC Developer Joined: Oct 2003 Reputation: 0 Location: Germany |
2004-08-19 23:34
Post: #16
i currently use "real" tabs in vs.net. am i the only one?
![]() btw, this is how most switch statements in the window classes are currently written: Quote:switchto discuss, if we keep it that way and add it to the conventions. ![]() greets bobbin007 Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. ![]() |
| find quote |
Gamester17
Team-XBMC Forum Moderator Joined: Sep 2003 Reputation: 9 Location: Sweden |
Maybe slightly off-topic but I like to request that we start requiring basic doxygen tags/comments in XBMC code (including patches). bobbin007 added a few doxygen tags/comments to XBMC CVS a few monts back but it never seem to catched on. BTW, see MPlayer uses it now too
![]() Also, always prefer American English over British English in comments and strings!
Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first.
(This post was last modified: 2007-12-19 17:29 by Gamester17.)
|
| find quote |
Gamester17
Team-XBMC Forum Moderator Joined: Sep 2003 Reputation: 9 Location: Sweden |
maybe borrow this text/guidelines bellow from mplayer (or parts of it?)?, what do you all think?:
Quote:date: tue, 31 aug 2004 09:14:36 +0900ps! ffmpeg has now also started using doxygen to document their source code. Always read the XBMC online-manual, FAQ and search the forum before posting. Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules. For troubleshooting and bug reporting please make sure you read this first. |
| find quote |
yuvalt
Retired Team-XBMC Member Joined: May 2004 Reputation: 0 Location: Israel |
2004-09-06 17:05
Post: #19
i don't think we'll ever reach an agreement on this thing.
can you sumbit an updated code style text and also put it in cvs? thanks, -yuval |
| find quote |
pade
Junior Member Posts: 17 Joined: Nov 2004 Reputation: 0 |
2004-11-04 23:53
Post: #20
(yuvalt @ sep. 06 2004,17:05 Wrote:i don't think we'll ever reach an agreement on this thing.i agree! there will ever be an agreement about coding standard and formatting. but... by using a code beautifier, we could increase the quality on this code and make it more readable for every body. i have been using gc (great code) for a while and it works fine for me. the only switch you desperately need is "-no-code_decl_move_top-" since the default is to move declarations to the top of the scope and the could ruin the code since also class objects with constructors will be move. the rest is just cosmetics. my opinion is that gc beautifies to much (read: changes to much), but using a beautifier gives you and your co-programmers so much back that i'm wiling to accept that if gc is to be used, the gc.cfg file (at least containing "-no-code_decl_move_top-") could be added to cvs root directory. most of the part of this topics discussion could then be about the gc.cfg file some words about code beautifier ========================= q. how to introduce them in a project? a. check out all code and parse the beautifier through the files, then check in the code without doing any other changes :thumbsup: q. doesn't a good programmer write code that is more readable than what a beautifier could do? a. yes, but how many of us does really take us the time of doing that :shifty: q. could i thrust a beautifier? a. yes, but first read this how can i trust beautifier programs??!! also read this from: how to write unmaintainable code :joker: never beautify: never use an automated source code tidier (beautifier) to keep your code aligned. lobby to have them banned them from your company on the grounds they create false deltas in pvcs (version control tracking) or that every programmer should have his own indenting style held forever sacrosanct for any module he wrote. insist that other programmers observe those idiosyncratic conventions in "his " modules. banning beautifiers is quite easy, even though they save the millions of keystrokes doing manual alignment and days wasted misinterpreting poorly aligned code. just insist that everyone use the same tidied format, not just for storing in the common repository, but also while they are editing. this starts an rwar and the boss, to keep the peace, will ban automated tidying. without automated tidying, you are now free to accidentally misalign the code to give the optical illusion that bodies of loops and ifs are longer or shorter than they really are, or that else clauses match a different if than they really do. e.g. if(a) if(b) x=y; else x=z; |
| find quote |


![[Image: badge.gif]](http://www.ohloh.net/projects/149/badge.gif)
![[Image: badge.gif]](http://www.ohloh.net/projects/9132/badge.gif)



Search
Help