| |||
Views: 88,523,947 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 05-03-24 03:28 PM |
|
Guest: Register | Login |
0 users currently in Computing | 1 guest |
Main - Computing - Programming Poll #1: Indent Style | New thread | Thread closed |
Kernal |
| ||
Gone Level: 88 Posts: 136/1881 EXP: 6465892 Next: 184772 Since: 02-20-07 Last post: 6153 days Last view: 6144 days |
Yes, I know there's no poll feature, just give your answer in the thread.
Question #1 is: How many spaces do you indent your code, and do you use tabs or spaces? I like to indent each block by 4 spaces. The default tab stop of 8 is just way too much for me, it causes the blocks to be really spread out horizontally in my opinion and you quickly run out of space for more blocks, especially when you have like a switch inside an if-else inside a loop inside another loop. One or two spaces doesn't set off the block enough for me. I prefer spaces to tabs becase I want it to show up as 4 spaces everywhere, whereas when I use tabs, loading the file in a different editor will show me eight spaces. I know tabs use less space in the file, but that doesn't matter too much in these days of multigigabyte hard drives. |
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 63/4196 EXP: 21545273 Next: 291328 Since: 02-19-07 From: Ithaca, NY, US Last post: 478 days Last view: 91 days |
|
setz |
| ||
Spike fuck~ Level: 58 Posts: 48/722 EXP: 1537780 Next: 39766 Since: 02-19-07 From: Pittsburgh, PA Last post: 5297 days Last view: 2585 days |
I just use the tab key, because it just makes it easy to keep your code lined up, and its 3 less keypresses than jamming on the spacebar 4+ times. I've always used tabs over spaces, though. spaces just seemed like a waste of time. ____________________ |
Acmlm |
| ||
Flurry Level: 37 Posts: 36/251 EXP: 315216 Next: 23037 Since: 02-19-07 From: Mirabel, Québec, Canada Last post: 6187 days Last view: 1820 days |
Flurry #&postrank& Like blackhole said, 2 spaces for me, at least for here (I still use Tab, there's an option in EditPlus to make it enter spaces) But I've also worked with 4-space tabs at times ...
AcmlmBoard 1.x was another story, where I used 2 space indents but grouped them into 6-space tabs to save space ... don't do that ____________________ |
Randy53215 |
| ||
Shyguy Banned by request Level: 22 Posts: 19/81 EXP: 57785 Next: 565 Since: 02-19-07 From: Greenfield, Wisconsin (U.S.A) Last post: 6098 days Last view: 6076 days |
Posted by Acmlm Essentially how I do things, depending how "big" the project is. I try to keep things as clean as possible. And YAY for a computer forum. |
Drag |
| ||
Spike Dragon Level: 57 Posts: 86/705 EXP: 1483822 Next: 2106 Since: 02-19-07 From: Last post: 3935 days Last view: 3935 days |
I use all sorts of different kinds of indentations (mostly because the different editors I use handle tabs differently. )
I use tabs most often, because it's really easy... press tab, yay indent! Press backspace, yay unindent! I'd rather there be too much instead of not enough. In NetBeans, I also use tabs, but NetBeans usually treats that like I've pressed space 4 times, so if I don't have the cursor in the right place when I hit tab, it'll indent incorrectly, leaving extra spaces or something. Also, to unindent, I have to backspace four times. Kind of a pain. ____________________ |
xeno |
| ||
Micro-Goomba Level: 9 Posts: 7/10 EXP: 2506 Next: 656 Since: 02-21-07 From: Somewhere around here... Last post: 6210 days Last view: 6109 days |
I just always tab. It's easiest and doesn't require me to think about indenting.
yup... |
Dr. Sophie |
| ||
Goomba Level: 12 Posts: 16/21 EXP: 7628 Next: 293 Since: 02-19-07 Last post: 6150 days Last view: 6083 days |
Two quick jams on the spacebar do it for me.
When I started coding things, I didn't like tab for spacing (for some reason I forgot), and instead used spaces. An indention with only one space looked too small, an indention with 3 and upwards spaces looked too big for me. So I used 2, and I just got used to that. |
Kawa |
| ||
CHIKKN NI A BAAZZKIT!!! 80's Cheerilee is best pony Level: 138 Posts: 47/5344 EXP: 30962594 Next: 700387 Since: 02-20-07 From: The Netherlands Last post: 4505 days Last view: 2640 days |
I do it like foo, me... ____________________ Wife make lunch - Shampoo Opera - give it a spin Spare some of your free time? <GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered Kawa rocks — byuu |
Randy53215 |
| ||
Shyguy Banned by request Level: 22 Posts: 20/81 EXP: 57785 Next: 565 Since: 02-19-07 From: Greenfield, Wisconsin (U.S.A) Last post: 6098 days Last view: 6076 days |
Mine look something like...
|
Katelyn |
| ||
beh Level: 86 Posts: 217/1816 EXP: 6133413 Next: 8694 Since: 02-21-07 Last post: 6153 days Last view: 6153 days |
I usually use two spaces for indents while coding in PHP and C++. |
OoBurns |
| |||
Boo Level: 68 Posts: 155/1036 EXP: 2643081 Next: 85719 Since: 02-19-07 From: It is a mystery. Last post: 5729 days Last view: 5729 days |
|
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 67/4196 EXP: 21545273 Next: 291328 Since: 02-19-07 From: Ithaca, NY, US Last post: 478 days Last view: 91 days |
|
Kernal |
| ||
Gone Level: 88 Posts: 144/1881 EXP: 6465892 Next: 184772 Since: 02-20-07 Last post: 6153 days Last view: 6144 days |
Not to mention alternating between Allman and K&R style of positioning the curly brackets (which will probably be Programming Poll #2). |
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 71/4196 EXP: 21545273 Next: 291328 Since: 02-19-07 From: Ithaca, NY, US Last post: 478 days Last view: 91 days |
|
HydraPheetz |
| ||
Red Cheep-cheep Level: 34 Posts: 22/216 EXP: 251638 Next: 2013 Since: 02-19-07 Last post: 6094 days Last view: 6075 days |
I tend to do this with my code (at least with languages that employ non-whitespace/non-newline statement terminators):
I only use tabs. I just use a tabstop of 8 (default in vim) and I split my lines where necessary (in languages like Python, where I can, especially for typing out long strings and passing a list of variables to be formatted in a string) so I don't get have to scroll around too much. ____________________ |
Cellar Dweller |
| ||
Snifit Level: 39 Posts: 2/287 EXP: 385407 Next: 19364 Since: 02-19-07 From: Arkansas Last post: 4059 days Last view: 3226 days |
I use the K&R bracing style (aka The One True Bracing Style) with a four space indent. I have my editor configured to use spaces for tabs.
The following is a code sample that I appear to have stopped in the middle of coding some time ago. int decode_recr(struct decode_state *ds, char *wp) |
never-obsolete |
| ||
Rat Level: 24 Posts: 2/96 EXP: 74538 Next: 3587 Since: 02-22-07 From: Phoenix, AZ Last post: 2603 days Last view: 2603 days |
I use 3 space tabs for high level languages, and 20 space tabs for assembly. |
spiroth10 |
| ||
Paratroopa Level: 29 Posts: 27/143 EXP: 135514 Next: 12371 Since: 02-22-07 Last post: 5923 days Last view: 5920 days |
My code looks like:
int main(){ //code goes here if(2+2 == 4){ printf("mooraidians rocks\n"); } else { //more code } //even more code return 0; } although I couldn't use tab for formatting, so I had to guess using only the spacebar . |
HydraPheetz |
| ||
Red Cheep-cheep Level: 34 Posts: 23/216 EXP: 251638 Next: 2013 Since: 02-19-07 Last post: 6094 days Last view: 6075 days |
Posted by spiroth10 It wouldn't show up correctly using just spaces. :< Stick it inside some <code> tags:
____________________ |
Main - Computing - Programming Poll #1: Indent Style | New thread | Thread closed |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 92, rows: 120/121, time: 0.017 seconds. |