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

Re: OT: Why is C so popular?



Joey Hess wrote:
Steve Lamb wrote:

   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;


That's bad style unless you have a reason to know for sure that you will
only ever need exactly one statement in the if. Since there's no benefit
to leaving out the braces and you'd have to think hard every time you
did, it's better to just avoid this C misfeature entirely..

not sure whether it is fair to call it misfeature. which brings us back to topic: IMO part of the popularity of C is that it has bunch of pretty simple but consistent rules that are taken to extreme (you can really apply them any way you want, if you can live with absurdity of it i[3] and 3[i] :-). that way you have a system (language) that can be used in ways undreamt of by inventors (authors?).

e.g. everywhere you have a statement you can have compound statement (because, after all, it's just a statement), everywhere you can have variable you can have expression etc.

so it would be quite inconsistent to suddenly say that in some special cases you can have compound statement but not a simple statement - it would screw the consistent application of simple rules.

  that said I also consider it better style to use if(something) { f(): }

	erik



Reply to: