What kind of coding styles do you adopt?
edit: DAMMIT my poll is meant to have checkboxes, not radio buttons.
Printable View
What kind of coding styles do you adopt?
edit: DAMMIT my poll is meant to have checkboxes, not radio buttons.
I don't really understand your poll. For instance, you could have brackets on their own line and use the hungarian naming convention.
Hence his comment of:
Which was done a good amount of time before your post.Quote:
DAMMIT my poll is meant to have checkboxes, not radio buttons
Well, I'm not quite sure what category mine is:
Code:// if / functions / classes / structs / loops:
int blah(float one, char two) { //space between ) and {, but on same line, ", " seperating each variable
statement; // instead of a space for an indent, I use tabs
}
Allman all the way
i can't really complete it without checkboxes... sometimes i put everything on one line, otherwise brackets get their own line...also, I don't know what some of them mean...Code:int className::retVal(){ return returnedval; }
int className::calcVal()
{
val+=2;
return val;
}
I can't stand brackets having their own line, it looks messy to me :)
:confused: That's weird. Completely opposite to most people. The only reason for having them on the same line is to save space and be able to see more lines at one time. Giving them their own line gives a clearer picture of the code block.Quote:
Originally posted by glUser3f
I can't stand brackets having their own line, it looks messy to me :)
>Giving them their own line gives a clearer picture of the code block.
Because indention is horrible for that purpose. :D We should inform Python users before any more damage is done. :p
Having brackets on their own lines in combo with proper indentation makes it a lot easier to match up brackets.
Now who uses spaces instead of indents? I do...now
uh... I said "clearer", as in better than just indenting.Quote:
Because indention is horrible for that purpose.
aka: in addition to, as well as, also, with, adjacent to, etc...
It just defines the block more clearly.Code:if(blahblahblah){
//stuff
//is second line part of a block? or what?
.
.
.
yup. A company I worked for had that in their coding standards so I adopted it.Quote:
Now who uses spaces instead of indents? I do...now
edit: fortunately visual studios has a setting that makes tab insert spaces instead of tab characters. That has made my life easier.
Yay someone else agrees!!!Quote:
Originally posted by glUser3f
I can't stand brackets having their own line, it looks messy to me :)
Allman non Hungarian. The professionals choice.
Hmm, I prefer to put empty lines where I need them, not because I just started another loop.Quote:
Originally posted by FillYourBrain
:confused: That's weird. Completely opposite to most people. The only reason for having them on the same line is to save space and be able to see more lines at one time. Giving them their own line gives a clearer picture of the code block.
And matching brackets is just as easy:
This is just my opinion, maybe bacause the fist book I ever read about programming used the coding style, don't know.Code:- for (int i = 0; i < SIZE; i++) {
| - if (done) {
| | break;
| - }
- }