| |||
Views: 88,521,768 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 05-03-24 10:03 AM |
|
Guest: Register | Login |
0 users currently in Computing | 1 guest |
Main - Computing - Programming Poll #1: Indent Style | New thread | Thread closed |
spiroth10 |
| ||
Paratroopa Level: 29 Posts: 28/143 EXP: 135511 Next: 12374 Since: 02-22-07 Last post: 5922 days Last view: 5920 days |
I know, but the edit feature isn't here yet...
The more I nest code, the deeper the indentations go... at least until a certain point (I have never reached this point yet). Nesting becomes useful as a (very very limited) replacement for hyperthreading in some areas. Using do while loops for this is possible, although it slows down code immensely probably increases memory consumption (never checked), is less efficient, and less powerful as hyperthreading, but is still a viable option for some applications. I've used such nesting for taking input before, and also for analyzing events. |
Drag |
| ||
Spike Dragon Level: 57 Posts: 94/705 EXP: 1483796 Next: 2132 Since: 02-19-07 From: Last post: 3935 days Last view: 3935 days |
I put my openbraces on the same line as the function that needs the openbrace.
void burp() { } struct burp { }; if (burp) { } else { } for (int burp = blah; burp < infinite; burp++) { } I always prefered that over putting the openbraces on the next line. I'm not quite sure why. ____________________ |
Ailure |
| ||
Hats Steam Board2 group Level: 121 Posts: 270/3965 EXP: 19790084 Next: 266612 Since: 02-19-07 From: Sweden, Skåne Last post: 3308 days Last view: 2059 days |
I use four spaces, because that's the netbeans formatting default. Sometimes I do what Drag explain.
Sometimes I also put stuff on single line, such as. if(true)runThisMethod(); Although I only do it if the line won't get too long. In assembly, I just do a single tab. Heh. I rarely program in assembly though. ____________________ AIM: gamefreak1337, MSN: Emil_sim@spray.se, XMPP: ailure@xmpp.kafuka.org
|
MathOnNapkins |
| ||
Super Koopa Level: 62 Posts: 28/842 EXP: 1936582 Next: 48104 Since: 02-19-07 From: durff Last post: 4495 days Last view: 4018 days |
Drag: that style drives me nuts. I wonder if there's a tool out there that converts between East Coast and West Coast coding style . ____________________ Zelda Hacking Forum hobbies: delectatio morosa |
Kernal |
| ||
Gone Level: 88 Posts: 154/1881 EXP: 6465776 Next: 184888 Since: 02-20-07 Last post: 6153 days Last view: 6144 days |
Yeah, when I was learning C, EVERY book I saw used Allman style:
so I just got used to that style, and I think K&R style (with the left curly bracket at the end of the previous line but the right curly bracket on its own line) looks so...wrong. And unbalanced. I have a much harder time reading K&R-formatted code for some reason. Also, I tend to omit the curly brackets if there's only one statement. |
blackhole89 |
| ||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 76/4196 EXP: 21544885 Next: 291716 Since: 02-19-07 From: Ithaca, NY, US Last post: 478 days Last view: 91 days |
|
Kernal |
| ||
Gone Level: 88 Posts: 155/1881 EXP: 6465776 Next: 184888 Since: 02-20-07 Last post: 6153 days Last view: 6144 days |
Crap,, the indentation didn't show up even with < code > tags. I guess I need to use nbsp? |
blackhole89 |
| |||
The Guardian Moloch whose eyes are a thousand blind windows! Level: 124 Posts: 77/4196 EXP: 21544885 Next: 291716 Since: 02-19-07 From: Ithaca, NY, US Last post: 478 days Last view: 91 days |
|
Kernal |
| ||
Gone Level: 88 Posts: 157/1881 EXP: 6465776 Next: 184888 Since: 02-20-07 Last post: 6153 days Last view: 6144 days |
I don't know, < code > was mentioned in HydraPheetz's post, so I assumed it existed... |
Kyargu |
| ||
between a rock and a hard place Level: 26 Posts: 75/115 EXP: 97754 Next: 4521 Since: 02-19-07 Last post: 4454 days Last view: 2332 days |
Posted by Kernal Google says it does. also, see w3c Also, I like to use 4 spaces for indent for pretty much the same reasons as the OP. |
Cellar Dweller |
| ||
Snifit Level: 39 Posts: 10/287 EXP: 385400 Next: 19371 Since: 02-19-07 From: Arkansas Last post: 4059 days Last view: 3226 days |
I used <pre>, but first I replaced every newline with a <br> tag. When the board adds the <br> tags, it leaves the newlines in place, causing <pre> to double space the text. Actually, it might just be converting half of a CRLF to a <br> tag and leaving the other half. |
MaxKnight |
| ||
Bullet Bill Level: 50 Posts: 127/502 EXP: 891473 Next: 55844 Since: 02-20-07 From: Springfield, Ohio Last post: 6105 days Last view: 6082 days |
Indent style? Visual Studio 2005 Professional's standard tabs.
Opening brackets? They get a line to themselves. ____________________ My current complication: Girl's name who gets no more than 10 minutes of screen time in the actual game. |
Jagori |
| ||
Red Goomba Level: 16 Posts: 10/35 EXP: 16410 Next: 3846 Since: 02-20-07 Last post: 6077 days Last view: 6075 days |
GNU '2+2' style is what I'm most used to. 4 spaces for each level of indentation, with the braces halfway. Braces are always present and on their own line, even if I could get by without them. I seem to be one of about six people who do it this way.
I'm mostly not picky about style, though. The only time I'll spend any effort to change a default indent style is if it's K&R. I just can't read that kind of code quickly, even if I wrote it. |
setz |
| ||
Spike fuck~ Level: 58 Posts: 54/722 EXP: 1537753 Next: 39793 Since: 02-19-07 From: Pittsburgh, PA Last post: 5297 days Last view: 2585 days |
Posted by Drag I know alot of people do that, but I think it really hurts the readability. for (int bitch=whore;bitch ....//doshit } seems so much easier to read for me. ____________________ |
DarkSlaya |
| ||
Cheep-cheep Level: 32 Posts: 26/189 EXP: 205954 Next: 488 Since: 02-19-07 Last post: 6008 days Last view: 6000 days |
Posted by setzPosted by Drag For some reason, I never really cared. But nowadays I do stuff on acmlmboards so I try to not code like that, so everyone can understand and stuff. |
Squash Monster |
| |||
Buster Beetle Level: 48 Posts: 6/469 EXP: 804895 Next: 18648 Since: 02-22-07 From: New York Last post: 5704 days Last view: 5703 days |
|
Main - Computing - Programming Poll #1: Indent Style | New thread | Thread closed |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 77, rows: 101/102, time: 0.013 seconds. |