Page 2 of 2

Posted: Mon Nov 05, 2007 12:36 pm
by patrick
Nice work guys! I agree to your ideas and comments.

Posted: Tue Nov 27, 2007 8:45 pm
by 1337
As of now, I have created a namespace for every subproject (like namespace "weapon" for my little project).

If nobody complains, I'm going to change that and simply create one namespace: orxonox.
And I'm also going to change the styleguide then. But I'll give it a little time...

Oh, there's something else: What is so important about keeping the code size to 80 characters, if almost everyone is using an IDE anyway?
I mean I wouldn't exactly agree to 200 characters, but 120 would be extremely more comfortable.
For instance it is now very common to use full names for variables and functions which makes them quite long. And then for a longer argument list you have to make line breaks and in order to improve readability you indent 2 or 3 tabs. All that within a namespace, function and "if" --> 68 characters left. And in a worst case scenario you can write two or three words per line because the next word is already too long to fit in.
I'm sorry to say that for all those who program with an 80 char console..

Posted: Tue Nov 27, 2007 10:19 pm
by beni
1337 wrote:I'm sorry to say that for all those who program with an 80 char console..
Whoever that is...

Posted: Tue Nov 27, 2007 10:59 pm
by 1337
beni wrote:
1337 wrote:I'm sorry to say that for all those who program with an 80 char console..
Whoever that is...
When I was doing the exercises for informatics I, I used to code with vim and the console. And consoles were or are (don't know) limited to 80 characters. Which is why programmers got used to not writing more than 80 chars on one line.

Posted: Wed Nov 28, 2007 8:19 am
by beni
Yeah I know. I remember my first year where I got minus points in my info exercises when the lines where longer.

What I meant: Who still writes with a console? Nearly everybody has an IDE and those who don't have at least a text editor like kate, kwrite, gedit or something. Even with nano it's possible to write lines longer than 80 characters.

I dunno.. but I don't think that anyone would even notice that, if the code was wider than 80 characters.

Posted: Sun Dec 02, 2007 11:07 am
by patrick
I expected someone to come up with this line-width-80 question :D I know that the code might look crapier and needs more time to format. But there are lots of people that use standard 80char consoles to code. For example I often look at code withvim/emacs in a console conected over ssh, in this case you will never have to worry about resizing your console.

But I know, there is no very strong reason to limit it to 80chars. Decide yourselfs if you want to go with the old fashioned 80 chars. But I suggest to have a line width limit otherwise, people with 24" screens will have a big advantage :D

Posted: Sun Dec 02, 2007 11:34 am
by 1337
Since I myself use vim, when I am in need of an editor, I think I'll stick to these 80-chars limit mostly, for instance for all comments. There you have to make line breaks anyway...

What about placing header files in header files?
I have compiled a list with all my class prototypes and called it "orxonox_prequisites". The entries are simply class BaseWeapon; class OrxonoxShip; class BarrelGun; etc.
We only have to make a few of these files and when someone adds a new class, he can edit the right file.
The advantage is, that whenever you want to use object pointers in class declarations (only works for pointers) in header files, eg. BarrelGun *myGun_; or in an argument list of a function, you can simply include the files with all the prototypes.
This way you can save a lot of compile time: Imagine you include "asdf.h" in your *.cc file and asdf itself includes "foo.h" and "bar.h". Now you have to compile 3 header files though you only need one: "asdf.h".
Of course right now this isn't a problem, but when the project grows, compile time grows too.

What do you think?
(This idea by the way, is from the Ogre source code)

Posted: Sat Dec 15, 2007 4:59 pm
by 1337
SO WHAT IS IT NOW?

2, or 4 spaces per tab? We really need to agree to a standard!

The style guide says 2..

Posted: Sat Dec 15, 2007 7:35 pm
by x3n
I don't care about the 80 char limit. Of course I understand the reason, but 99% of the users don't have a problem with larger lines and that's enough.

@2 or 4 spaces per tab: I can hardly read code with 2 space tabs, that's why I'm using 4 in my code, but it's only a personal preference. Is there a good reason for using 2 spaces?

Posted: Sun Dec 16, 2007 12:08 pm
by beni
x3n wrote:Is there a good reason for using 2 spaces?
You don't exceed the 80 char limit too quickly ;)

Posted: Sun Dec 16, 2007 1:22 pm
by 1337
beni wrote:
x3n wrote:Is there a good reason for using 2 spaces?
You don't exceed the 80 char limit too quickly ;)
Actually you do, but never mind me saying that...

#x3n: I totally agree with you. I once had 3 or 4 spaces as a tab, since it really brings more readability into the code. Anyway, I had to change. So, if I can make things finally compile under VC8, and if I have to edit the WorldEntity, I will adapt your file to 2 tabs ;)
But as of right now, I'm still having trouble (at least one more with the getMouseState()) compiling the project. And I really doubt it will run in the first attempt.