6

We have 4k Monitors and SSDs with more than 120 GB, why there are still new projects that use a formatting style that doesn't have a clear relation of the opening { and corresponding closing }. i.e. put them either on the same line or column?

Please don't write code where the imaginary line between the { and } goes diagonally over other parts of the code. It makes it unreadable and my brain hurts from looking at it. Its better to have readable code and "waste" some lines and bytes for code that is easier to read.

Comments
  • 2
    Linters exist, too
  • 4
  • 1
    Wait what?
    You mean something like;

    soSomeMethod {

                                                        }

    Instead of

    someMethod {

    }

    or even

    someMethod
    {

    }
  • 0
    Use proper indentation and syntax highlighting then. Every decent editor can highlight indentation/scopes and bracket pairs obvious enough to see them from the next room through the wall.
  • 1
    @molaram Because the build one block. If you have this:

    int function(void)

    {

    return 0;

    }

    You "see" a imaginary line between the { and } and all the code belonging to that block is right to that line. In comparison if you have:

    int function(void) {

    return 0;

    }

    This imaginary line is diagonal and goes over the other text. This makes it annoying to read, ugly and no, just no.
  • 0
    @C0D4

    The most readable of this is:

    int function(void)

    {

    return 0;

    }
  • 0
    @deadlyRants The problem is not the editor. The problem is the formatting, there is nothing syntax highlighting or indentation highlight like that can change. If you can't look at the code but need some extra indication from the editor to see the indentation, the indentation style is bad. A picture to illustrate the problem (editor syntax highlighting removed):
  • 2
    @happygimp0 Why are you going on about imaginary lines when every decent fucking editor can literally show such lines automatically? Just turn that on and you've got all the straight lines you need.

    Use whatever makes you happy, just know that syntax highlighting made this weird coding style obsolete for everyone else.
  • 3
    I mean if there's a closing bracket and another line with the same indentation it's clear what that means.
  • 0
    I don't have an issue with this either way (i.e. both straight and diagonal are about equally readable for me) even when using an editor that doesn't show scope. It's pretty easy to imagine the line from the first character of the first line to the ending brace on the last line in a "plain" editor too.

    I only care that a project is consistent about using them.
Add Comment