Re: indented code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Karl Dahlke wrote:
> Well - I seem to have inadvertantly started a fire storm.
> Didn't mean to do that.

I'm just happy to see that this list is alive.  the users list is for
users who mostly don't care about code details.

[.. Snip stuff about jumping to matching braces ..]
> Now that I'm use to this feature, I don't know what I'd do without it.

It sure is handy, especially for code where the opening brace doesn't
begin a newline.  In my own code, I start a new line for a new brace, but
I try to match the style of the code I'm working on where possible.

[.. Snip stuff on using indent ..]

There's some option to indent that causes it to indent foo and *bar
differently because *bar has the * on it.  This option is annoying, and I
never did figure out whether that can be seperately controlled from the
option that seperates types from identifiers in variable declarations.  My
advice: have indent just have one space as in int foo; rather than try to
do the visual alignment thing in that case.  It just comes out ugly.

GNU indent allows you to specify -ts 4 if you prefer 4 space indent with
hard tabs.  I have vim set up this way by default, but have actually set
up a macro to cycle between that an a couple of other typical settings
people use.  Once again, I code my way, but for other people's projects I
try to code their way.

Linus Torvalds is widely quoted recommending that you print a copy of the
GNU Coding Standards, and then burn them as a symbolic gesture.  This
isn't a bad idea.  The one formatting thing I never understood about GNU
is that they want a newline and a two-space indent for an opening brace,
then another newline and two-space indent for the content of the block.  I
start a new line for an opening brace to keep blocks' opening and closing
points easily visible.  Contents of blocks I indent sure, but not the
opening and closing braces.  That's just strange.

"We are what we repeatedly do.  Excellence, therefore, is not an act,
but a habit."
	-- Aristotle

[Index of Archives]     [Linux for the Blind]     [Fedora]     [Kernel List]     [Red Hat Install]     [Red Hat Watch List]     [Red Hat Development]     [Gimp]     [Yosemite News]     [Big List of Linux Books]