View Full Version : White spaces

10-12-2001, 01:47 PM
What kind of whitespaces do you use?

10-12-2001, 01:49 PM
I go with option 2. I hate too much spaceyness, but I like to read code.


10-12-2001, 03:06 PM
I'd rather write code fast, not waste time with spaces


10-12-2001, 08:46 PM
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.

10-12-2001, 08:55 PM
Um you forgot:

for (x










10-12-2001, 09:27 PM
i go with #1

10-12-2001, 10:10 PM
I prefer #2 - it's not too spaced out, but I can easily edit the code if I need too.

10-13-2001, 06:44 AM
Yeh, I go with Evenflow (hey that rhymes). I need to read the code when it's done.

10-14-2001, 12:01 AM
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! :)

10-14-2001, 01:27 AM
i like gamegod's suggestion.....

10-14-2001, 08:52 AM
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++ ) {

10-14-2001, 01:48 PM
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.


10-14-2001, 01:53 PM
#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++ )



10-14-2001, 02:00 PM
to each his own... but given your age i think you can only know so much... good luck then...

10-14-2001, 04:40 PM
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.

10-15-2001, 02:11 AM
I'll go with too, two ;)

10-15-2001, 06:46 PM
Well, I think it's ananomys. #2 is the best and most used.

10-16-2001, 09:24 AM
well, it must change depending where you live on: everyone I know (who knows programming), uses #1


10-16-2001, 12:56 PM
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.

10-16-2001, 03:41 PM
Listen to no-one. He knows what he's talking about. #2 is just the perfect coding practice.

10-16-2001, 04:48 PM
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?


10-16-2001, 06:40 PM
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.

10-16-2001, 07:00 PM
Never mind. A false alarm. He was just sticking up for me. I feel stupid.

10-16-2001, 08:59 PM
By the way, you did programming since 3+ (is that 18?), were you doing Logo?


i said i've been programming for 3+(eg. 3 or more) years, but as for languages i was refering to C/C++.

11-15-2001, 12:25 PM
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?


11-15-2001, 05:53 PM
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?

if ((a - b) == (c - d));
if ( (a - b) == (c - d) );

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...

The V.
11-15-2001, 06:17 PM
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.

11-16-2001, 12:44 AM
I use #1. But sometimes you have to watch out or you get something you were not expecting.
What if you are passing around pointers and want to divide with it? (not a 100% example, just a quick demo)

int MyFunct(int *iInt)
int iNew=0,iTwo=2;

iNew=iTwo/*iInt;// /* is the same as // (but we all knew that)

11-16-2001, 04:50 AM
I use #1, but should probably use #2 because it is easier to read.

11-16-2001, 06:26 AM
int myFunction(int arg1, int arg2, ... int argN)
int i;
for(i = 0; i < arg1; i++)
/* source code */

return argN;

That's how i like to do it.


11-17-2001, 07:01 AM
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.

11-18-2001, 02:05 AM
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! :)

11-18-2001, 03:47 AM


She doesn't program any more :( (not in C)

11-18-2001, 08:17 PM
I am not picking anyone of those, because I do mine like this...

for (x=0; x<5; x++)

11-18-2001, 08:24 PM
I usually use (x > 5), but I generally use all of them.:D