pouët.net

Wich indent style do you use?

category: general [glöplog]
thec: that's only true if you only use tabs. However, often people will be using a combination of tabs and spaces, and that's where the problems start :-)
added on the 2006-08-28 21:16:32 by sparcus sparcus
well, you should always tab in to your depth, and space to fill out for multi line code... that way it doesn't matter since you originally have n tabs, and n+s spaces on the following rows...

I'd say the problem is that many coders want spaces instead of tabs, because they think that's the only way to make sure the code looks the same everywhere, which is like I said, not needed.
added on the 2006-08-28 21:18:45 by thec thec
thec: ok, but I understand that you then don't use tabs to align variable names in declarations? Like f.e. "<tab>int<tab>i;"
added on the 2006-08-28 21:26:40 by sparcus sparcus
10 PRINT "I AM A 1337 CODER++ AND I SHIT ON INDENT"
20 GOTO 10
added on the 2006-08-28 21:34:35 by doh doh
I for one, do also the space before bracket after function call thing. Weird me.

Code: Maybe<Commands::Command> currentCommand; while (NOTHING != (currentCommand = commandBuffer.readNext ())) { if (Commands::FLASH == currentCommand.value().destination) { flashAt = f; font->draw ("cunt"); } else if (Commands::SPAWN == currentCommand.value().destination) { tick->rearm (); font->draw ("bitch"); } }

added on the 2006-08-28 21:47:55 by _-_-__ _-_-__
I'm not sure I understand the question, I usually have a big main(), about 5000 lines long, without indent :)
added on the 2006-08-28 21:51:30 by keops keops
Does it contain gotos as well? :)
added on the 2006-08-28 21:52:20 by Preacher Preacher
Plenty! :)
added on the 2006-08-28 21:55:46 by keops keops
sparcus: of course, intendation with tabs can only be done in the start of a line...
added on the 2006-08-28 22:01:26 by thec thec
hmmm this is the only piece of code i can find done by me (1995? 1996?)

Code: program mosquito; uses crt,dos; var dat :text; procedure autoexec; begin {of autoexec} assign(dat,'autoexec.bat'); append(dat); writeln(dat,'MOSQUITO'); end; begin {of main} autoexec; sound(5000); end.


=)
added on the 2006-08-28 22:13:36 by dipswitch dipswitch
tabs are useful for editing aligned lines without much effort. i'd prefer to use 4 space width tabs and never encountered other than that and 8. I'd rather specify tab width at the beginning of the document than senselessly adding billions of spaces. especially if you have many nearly identical lines, like class constructor or data arrays or unrolled loops.

and i also hate one specific style of indenting. that is adding the first argument after function declaration-definition and listing others at new lines padded with lots of space to align with the first. like the code glade generates. i'm so pissed of the style that i won't try to give an example.

and imo discussing indentation is a bit senseless than discussing styles of charts, like flowcharts, class relation diagrams or system graphs. they also tend to reveal design approaches and eliminates the pain of reading code. though it seems noone bothers using these unless they have to because of their work :)
is this really a pouet thread?
added on the 2006-08-28 22:30:44 by the_Ye-Ti the_Ye-Ti
omg turbo pascal!
added on the 2006-08-28 22:34:54 by jua jua
i forgot

BB Image
I used to use one space, until the people at work started throwing stuff at me whenever I committed stuff. It's 4 spaces all the way now :(
added on the 2006-08-28 22:59:36 by Shifter Shifter
BB Image
added on the 2006-08-28 23:07:17 by wb wb
BB Image

someone had to do it.
added on the 2006-08-28 23:21:03 by Zest Zest
I use the second method. I did so even in Pascal years ago.

Code:mot@bones:~$ cat ~/.vimrc :set ts=4 :syntax enable


The above means that in vim, I use 4-space tabs and syntax highlighting.


added on the 2006-08-29 01:04:15 by moT moT
c-jump WTF!
added on the 2006-08-29 11:44:12 by texel texel
my lines are very long so I use no indent style whatsoever.
added on the 2006-08-29 11:56:59 by Navis Navis
I love the idea of that c-jump game!

"Ages: 11+" - seems about adequate, though some younger ones will certainly also be interested.
added on the 2006-08-29 12:20:50 by Adok Adok
i write in the style of anesthetic but using tabs instead of four spaces or whatever. when i used to write in edit i used spaces though, because the tabs were too long.
added on the 2006-08-29 12:51:03 by linde linde
Adok: 11+ or mensan babies.
added on the 2006-08-29 12:59:03 by Zest Zest
Zest: I guess I'll buy such a toy for my future kids. =)
added on the 2006-08-29 13:09:24 by Adok Adok

login