Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

The real reason why indentation In C matters

Name: Anonymous 2009-04-19 8:39

You won't find the error without splitting everything into small chunks.

Name: Anonymous 2009-04-19 8:50

I'd split you into small chunks.

Name: Anonymous 2009-04-19 8:58

>>2
I just imagined myself splitted into pieces and grinning maniac murmuring about the errors he finds in me.

Name: Anonymous 2009-04-19 9:42

The compiler splits everything into small chunks using its EXPERT TOKENIZER which is why it is so good at finding errors.

Name: Anonymous 2009-04-19 9:47

>>4
C COMPILER IS A MURDERER

Name: Anonymous 2009-04-19 16:50

If you write i=i++, your computer can teleport itself to 16th century Wittenberg and change Western history by nailing sections 1.6 and 3.3 of ANSI X3.159 to the church door.

Name: Anonymous 2009-04-19 18:55

>>6
Are you implying K&R are anti-semites?

Name: Anonymous 2009-04-19 22:17

>>6
I tried that and it didn't work, where do I file a compiler bug?

Name: Anonymous 2010-03-03 7:23

INDENTATE MY ANUS

Name: Anonymous 2010-03-03 8:21

>>1
http://en.wikipedia.org/wiki/Indentation
i disagree, sheeple. indentation is bloat and a good programmer will tokenize and compile the program in his mind. most c and javascript functions can be successfully be written in four or less lines and it conserves screen real estate. to maximize it i also dont use monospaced font and have #defined many common patterns to one or two letter abbreviations. when you write your post do you indent. no because a program tells a story that should be understood without indention.
_________________________________
orbis terrum delunda est

Name: Anonymous 2010-03-03 9:03

>>10
I lol'd

Name: Anonymous 2010-03-03 9:22

>>10
      Actually, I don't indent because it usually don't work.
The code tag averts this.

Name: Anonymous 2010-03-03 9:47

>>10
#GNU style

Like the Allman and Whitesmiths styles, GNU style puts braces on a line by themselves, indented by 2 spaces, except when opening a function definition, where they are not indented[5]. In either case, the contained code is indented by 2 spaces from the braces.

Popularised by Richard Stallman, the layout may be influenced by his background of writing Lisp code. In Lisp the equivalent to a block (a progn) is a first class data entity and giving it its own indent level helps to emphasize that, whereas in C a block is just syntax. Although not directly related to indentation, GNU coding style also includes a space before the bracketed list of arguments to a function.

Name: Anonymous 2010-03-03 10:21

>>13
Don't blame Lisp for Stallman not having a sense of aesthetics.

Name: Anonymous 2010-03-03 11:27

duh

Name: Anonymous 2010-03-03 17:08

>>13
I guess that's why GNU style goes:

int main (int argc, char **argv) {
  int i;
  for (i = 0; i < argc; i++) {
    puts(argv[i]);}}


Somebody ought to do something about the retarded comparison to Lisp code.

Name: Anonymous 2010-03-03 17:18

8-space tab width K&R style on an 80x24 terminal is, truthfully, the only way to go.
The restricted space helps you put extra thought into not usingExtraVerboseCamelCaseVariables and designing your program such that it is efficient and compact whilst maintaining readability.

Name: Anonymous 2010-03-03 17:34

>>17
I'm partial to 2-space indentation actually. The first company I worked at did it this way and I ended up really liking it.

Also, the tab character should burn in hell. Spaces are the only way.

Name: Anonymous 2010-03-03 17:38

>>18
NO U

Name: Anonymous 2010-03-03 17:46

>>17
8-space tab width
80x24 terminal
Brilliant!

Name: Anonymous 2010-03-03 17:53

>>17
8-space tabs make it harder for your eyes to take in a block of code all at one go.

For a while I used 4-space tabs, but my code host displayed them as 8-space, fucking up the formatting. I finally converted to 2 space indentation (with actual spaces) to follow a project's coding standard, and haven't looked back.

Name: Anonymous 2010-03-03 17:54

4-space tabs works fine for me.

2-space looks messy.

Name: Anonymous 2010-03-03 18:04

We know code gets indented but what is an appropriate way to indent newline comments?

Name: Anonymous 2010-03-03 18:08

wow ppl try to troll over how many spaces a tab character should have..

Name: Anonymous 2010-03-03 18:11

>>24 4 of course.

Name: Anonymous 2010-03-03 18:14

>>24
>>18 here, I usually set the tab character to take 13 spaces so that the evil tab characters stand out. I also like that my svn/git diffs use 8 spaces for tabs so I can see them there too.

Name: Anonymous 2010-03-03 18:41

I actually use inverse identation, making the first statements at least 20 spaces ahead and decreasing that value.

Name: Anonymous 2010-03-03 20:03

>>27
Nice, but you could do better.

                              int main()
                                       {
                    puts("SUSSMAN");
                           return 0;
                                       }

Name: Anonymous 2010-03-03 21:48

If your indentation gets fucked up after changing the tab width you're using tabs wrong.
Makes using them kind of pointless if you can't even change their width, don't you think? What's the point?

Name: الأنونيموس 2010-03-04 2:08

>>27
>>28

Are you trying to code in Arabic?

Name: Anonymous 2010-03-04 2:56

>>29
Makes using them kind of pointless if you can't even change their width, don't you think?
Exactly!

Name: FV QUALITY 2010-03-04 5:01

void main(){puts("SUSSMAN");}

Name: Anonymous 2010-03-04 5:18

>>22
The TROLLGOL spec requires 3-space tabs, in the spirit of compromise.

Name: Anonymous 2010-03-04 7:45

>>33
This is only half correct, TROLLGOL doesn't REQUIRE it, although we fully support 3 space tabs as the NEW INDUSTRY STANDARD.

Name: Anonymous 2010-04-14 15:24

I wish TROLLGOL had a stable release.

Name: Anonymous 2010-04-14 16:35

>>35
I hope you are condemned to write Enterprise Solutions in INTERCAL for the rest of your life.

Sorry, that was harsh.

Name: Anonymous 2010-04-14 17:29

>>35
surely a stable release would defeat the entire purpose of the language

Name: Anonymous 2010-04-14 19:29

int
main
                      (
 int argc, char **argv
)
                           {
 int i;
 for (i = 0; i < argc; i++)
                {
  puts(argv[i]);
 }

 return 0;
}

Name: Anonymous 2010-04-14 23:50

>>37
Not if it's undocumented.

Name: Anonymous 2010-04-15 7:06

bump

Don't change these.
Name: Email:
Entire Thread Thread List