ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

indent wars..

(1/2) > >>

mouser:
personally i have always been deeply in love with whitesmith style, which is how i learned to write c code..

http://everything2.org/index.pl?node=indent%20style

what's your favorite?

Gothi[c]:
I've always been coding like so:


--- ---#someInclude

// Some comment

int someFunc()
{
  blah() ;
}

allen:
Closest match to me is GNU.

I like two spaces.  Just enough to make a distinction, without consuming line space.

I hadn't realized there were all thse named indentation styles.  I'm unedumicated.


--- ---// some comment
someFunc() {
  blah;
  moreFunc() {
    meh;
  }
}

jgpaiva:
I also use a similar indentation to the one Allen uses, but with a tab instead of two spaces. IMO it makes more sense to have the last bracket aligned with the function that opened it, it's easier to know when there's a bracket missing.
I think this indentation is the default for emacs, at least, i use it in emacs. Although in the page mentions that it should be "gnu style" indentation, i think it's more similar to K&R indentation, if not that one.

allen:
I originally started using spaces rather than tabs after writing a web-based file editor for use away from home.  Pressing tab would knock me out of the box, so I just got accustomed to double tapping the space bar.  (as it was, I'd already decreased tab size to 3, then 2 spaces to decrease wasted whitespace).

It does make sense to match start/end brackets in the same column for easy glancing for unclosed brackets.  I end up relying on my text's matching bracket highlighter.  If it matches with the wrong bracket or none at all, I missed something ;)

Navigation

[0] Message Index

[#] Next page

Go to full version