What kind of whitespaces do you use?
Printable View
What kind of whitespaces do you use?
I go with option 2. I hate too much spaceyness, but I like to read code.
--Garfield
I'd rather write code fast, not waste time with spaces
Oskilian
But it is so much harder to read in future reference for debugging. That, and it takes about a millisecond to hit the space bar.
Um you forgot:
Code:
for (x
;
x
<
10
;
x
++
;
)
i go with #1
I prefer #2 - it's not too spaced out, but I can easily edit the code if I need too.
Yeh, I go with Evenflow (hey that rhymes). I need to read the code when it's done.
hmmm... speaking of which... i adopted the practice of putting a space between the opening parenthesis in a function calls parameter list, as well as the protype/declaration... and, as such, it annoys me when reading other's code... there should be a compiler's limit on the number of lines in a code block! :)
i like gamegod's suggestion.....
I must be one of the few who prefers #3. Not only is it easy to read and is consistent, it also looks nice and that's important :D
However, I don't space my semicolons, that's just plain wierd. This is my preference.
for ( i = 0; i < something; i++ ) {
c'mon mr. Unregistered, don't make a moderator close this nice little thread, if you want to harass garfield, open a separate thread, and Garfield: don't answer it, you could make a moderator close this thread.
by the way: why do you say that to Garfield, everyone has it's own way to code.
Oskilian
#1 is good for robots
#2 is good for people semi-new to computers (not using them for your whole life)
#3 is good for real computer gurus, I use #3, becouse coding is instant, I think and it is 'instantly' typed. I've been typing for almost my whole life, so 'time' really dont matter to me, I type with patternz, whitch lets me type a huge amount of charachters quikly, and I really dont care, cuz its great readabuility!
for( int sloop = 0 ; sloop < blah ; sloop++ )
:)
SPH
to each his own... but given your age i think you can only know so much... good luck then...
Uh oh! let's all change our votes to #3 because it's "for gurus"!
I vote 2 - I can't stand too many spaces, and it's still readable without looking like crud.
I'll go with too, two ;)
Well, I think it's ananomys. #2 is the best and most used.
well, it must change depending where you live on: everyone I know (who knows programming), uses #1
Oskilian
ok i have been programming since before you people knew what it was...ok some of you anyway, ok about 3 of you, but i've been programming for at least (and i can't even remember since my brain is on fire right now...) 3+ years and i've read code from most of the damn Guru's and about a million other people and heres my opinion,including my own
#1 error prone during reading, you might miss something
#2 just right everythings clear and plain, and it can be read quickly.
#3 over spaced, makes it harder to read.
Listen to no-one. He knows what he's talking about. #2 is just the perfect coding practice.
I agree, #2 is the nicest, but I've grown with #1, so there's nothing I can do about it
By the way, you did programming since 3+ (is that 18?), were you doing Logo?
Oskilian
Hey, all of you of this thread. Go to the C board and look at the thread entitled "Interesting little exercise...". There is this Unregistered guy that is attacking me. I am just trying to help and he is critisizing me out of no where. Can I get a mod here to do something? Thanks.
Never mind. A false alarm. He was just sticking up for me. I feel stupid.
>
By the way, you did programming since 3+ (is that 18?), were you doing Logo?
<
what...huh.
i said i've been programming for 3+(eg. 3 or more) years, but as for languages i was refering to C/C++.
I use #1, it is fast, but you are right, you can miss something while debugging, but if you learned in a way, why would you change it?
Camilo
i had to change to 2 from 1. i also changed from adding more whitespace to my code to increase readability... however. what about this case?
i end up doing the first, but like to do the second since it seems more readable... however contradictory... so the point being the nested parenthesis...Code:if ((a - b) == (c - d));
*or*
if ( (a - b) == (c - d) );
I use #2. Not too much whitespace, not too little. I do vary my practices when I have many levels of parantheses, I space them until I can see at a glance how parentheses pair. I don't have a fixed rule for them, per se.
I use #1. But sometimes you have to watch out or you get something you were not expecting.
ie
What if you are passing around pointers and want to divide with it? (not a 100% example, just a quick demo)
Code:int MyFunct(int *iInt)
{
int iNew=0,iTwo=2;
iNew=iTwo/*iInt;// /* is the same as // (but we all knew that)
}
I use #1, but should probably use #2 because it is easier to read.
That's how i like to do it.Code:int myFunction(int arg1, int arg2, ... int argN)
{
int i;
for(i = 0; i < arg1; i++)
{
/* source code */
}
return argN;
}
adios,
biterman.
I don't think you can read someone else's #1. Specially if you have to use big formulas.
I think #2 is just perfect, but it doesn't really make a different if a read someone else's #3.
My fiance uses #1 and I get lost if I try to read her tamagotchi code.
gasp!!! ooh ooh ooh, code lovers... ;) very sweet... ooh ooh... cheers...
lol, i can imagine you two having minor bickerings over coding style... how sweet! :)
LOL :D
;)
She doesn't program any more :( (not in C)
I am not picking anyone of those, because I do mine like this...
for (x=0; x<5; x++)
I usually use (x > 5), but I generally use all of them.:D