3
purist
7y

Why would the great linux devs and the 'C prophets' choose K&R indentation model ahead of Allman's model ? Its saddening that i would have to work with K&R style for my future works !

Comments
  • 1
    I've never once had a problem using single-line statements after a condition. Honestly don't get why people consider this a big deal.

    If you need to add another line, put brackets in. It's not rocket science.

    If you seriously don't notice that there aren't brackets there, I'm sorry but you are too stupid to be a programmer.
  • 0
    @devios1 Looks like i communicated the message wrong ! The question was supposed to be about bracketing and stuff ! K&R is the one where brackets start in the same line as the condition ...like..
    if(condn){
    stmnts;
    }
    Allman's is ..
    if(condtn)
    {
    stmnts;
    } . To me 2nd one makes more sense !
  • 1
    @harish1996 Sorry I misinterpreted.

    Good lord I just looked it up and had no idea there were so many different indentation styles. Most of these are utter insanity to me though.

    I don't align exactly with any of these (no pun intended), though Linux Kernel is closest. But tbh I'm happy letting people format their code however they like. I disagree with the notion that an entire codebase has to follow the same indentation style and consider it an absurd and pointless goal.

    To me, coding style is like a person's accent. It doesn't affect the *meaning* of the code and therefore people should not be so damn uptight about it.

    I actually like being able to look at a block of code and being able to tell who wrote it just based on the style.

    https://en.wikipedia.org/wiki/...
  • 0
    @devios1 I don't really agree with you, having an inconsistent coding style makes reading code much more tedious. It's like reading a letter where every phrase is written by a different person: my brain will be uselessly distracted.

    My philosophy is more that I don't really care which style we use, but let's be consistent
  • 0
    @willol changes in whitespace don't make reading code any more tedious to me. Ugly, yes, but I have no trouble reading it. It's whitespace ffs.
Add Comment