On Wed, 27 Aug 2003 23:52:35 -0600 Jacob Anawalt <[EMAIL PROTECTED]> wrote: > Was this code on a Unix system, or did you have one nearby? Did you know > about the indent program at the time? (man indent) > It _seems_ to work for me to convert someone elses sytle (or lack of it) > in coding C into a format that I like (K&R).
That's just it, I don't like C indenting any more, period. It isn't "someone else's style" that is the problem, it is the fact that it is the antithesis of how I've grown to like to code. Lemme put it this way: C: if foo bar; Python: if foo: bar Want to extend it? Python: if foo: bar baz C: if foo bar; baz; Bzttttt, wrong.... if foo { bar; baz; } But wait, baz really shouldn't be a part of the if statement! Python: if foo: bar baz C: if foo bar; baz; No, darn it, only if foo is false, really. Python: if foo: bar else: baz C: if foo bar; else baz Nope... if foo { bar; } else { baz; } It boils down to this. In Python if I want something to be in a block, I smack tab and don't even need to worry about my editor doing the right thing. I tell it to set tab stops to 4, save all spaces and how the code is written is how it will run. If I need to pull that call out of a block I just delete space to line up to the previous block. << or >> or V<, V> or several other commands in vim work nicely for this. If I need to add to a block I just tab over to the right spot and there it is. The main problem with "other people's style" isn't so much a matter of indenting blocks (any half-assed decent programmer does that to some degree) it is a matter of block delimiter placement. Some people prefer to have the block delimiters separate of the line that starts the block. Some prefer the opening on the same line so the closing lines up with the keyword opening the block. Some consider else its own block and having it line up with the if makes sense. Others consider it a continuation so they slap it onto the end of the if block. What have I described? a: if cond { block } else { block } b: if cond { block } else { block } c: if cond { block } else { block } 3 different styles. But remove the damnedable braces and what are you left with? if cond block else block Hence it is not other people's style I dislike, it is the freakin' braces. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your PGP Key: 8B6E99C5 | main connection to the switchboard of souls. -------------------------------+---------------------------------------------
pgp00000.pgp
Description: PGP signature