| |||
Views: 88,495,953 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 04-28-24 09:58 AM |
|
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: 6463200 Next: 187464 Since: 02-20-07 Last post: 6148 days Last view: 6139 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: 21536306 Next: 300295 Since: 02-19-07 From: Ithaca, NY, US Last post: 473 days Last view: 86 days |
|
setz |
| ||
Spike fuck~ Level: 58 Posts: 48/722 EXP: 1537140 Next: 40406 Since: 02-19-07 From: Pittsburgh, PA Last post: 5292 days Last view: 2580 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: 315085 Next: 23168 Since: 02-19-07 From: Mirabel, Québec, Canada Last post: 6182 days Last view: 1815 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: 57761 Next: 589 Since: 02-19-07 From: Greenfield, Wisconsin (U.S.A) Last post: 6093 days Last view: 6071 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: 1483205 Next: 2723 Since: 02-19-07 From: Last post: 3930 days Last view: 3930 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: 2505 Next: 657 Since: 02-21-07 From: Somewhere around here... Last post: 6204 days Last view: 6103 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: 7625 Next: 296 Since: 02-19-07 Last post: 6145 days Last view: 6078 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: 30949704 Next: 713277 Since: 02-20-07 From: The Netherlands Last post: 4500 days Last view: 2635 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: 57761 Next: 589 Since: 02-19-07 From: Greenfield, Wisconsin (U.S.A) Last post: 6093 days Last view: 6071 days |
Mine look something like...
|
Katelyn |
| ||
beh Level: 86 Posts: 217/1816 EXP: 6130859 Next: 11248 Since: 02-21-07 Last post: 6148 days Last view: 6148 days |
I usually use two spaces for indents while coding in PHP and C++. |
OoBurns |
| |||
Boo Level: 68 Posts: 155/1036 EXP: 2641981 Next: 86819 Since: 02-19-07 From: It is a mystery. Last post: 5724 days Last view: 5724 days |
|
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 67/4196 EXP: 21536306 Next: 300295 Since: 02-19-07 From: Ithaca, NY, US Last post: 473 days Last view: 86 days |
|
Kernal |
| ||
Gone Level: 88 Posts: 144/1881 EXP: 6463200 Next: 187464 Since: 02-20-07 Last post: 6148 days Last view: 6139 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: 21536306 Next: 300295 Since: 02-19-07 From: Ithaca, NY, US Last post: 473 days Last view: 86 days |
|
HydraPheetz |
| ||
Red Cheep-cheep Level: 34 Posts: 22/216 EXP: 251534 Next: 2117 Since: 02-19-07 Last post: 6089 days Last view: 6070 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: 385247 Next: 19524 Since: 02-19-07 From: Arkansas Last post: 4054 days Last view: 3221 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: 74507 Next: 3618 Since: 02-22-07 From: Phoenix, AZ Last post: 2598 days Last view: 2598 days |
I use 3 space tabs for high level languages, and 20 space tabs for assembly. |
spiroth10 |
| ||
Paratroopa Level: 29 Posts: 27/143 EXP: 135457 Next: 12428 Since: 02-22-07 Last post: 5917 days Last view: 5915 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: 251534 Next: 2117 Since: 02-19-07 Last post: 6089 days Last view: 6070 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.018 seconds. |