1. 14

  2. 14

    This is why gofmt is one of my favourite things about Go.

    1. 3

      I honestly loathe mixed tabs and spaces in c formatting standards.

      Especially when you turn on “lets look at how this is all laid out shall we” whitespace mode in emacs and see that no, not everyone bothered they just edited in vi/vim and it lined up so whatever its all good.

      1. 2

        This is how I feel when turning on whitespace-mode in some codebases: http://nonadventures.com/2013/07/20/a-whiter-shade-of-fail/

    2. 3

      This is why I wish the languages I use C and C++ would dictate a single coding standard and just fail to compile anything else. It doesn’t matter which coding standard is used, you get used to it, but reading say Linux kernel code is almost like a different language compared to say C examples using Win32. Boost or C++11 examples are probably different to QT example code.

      It might have been better if they had been forced to follow the same standard.

      1. 2

        The problem with standards isn’t their goal, it’s what happens when someone who is not-you is writing them. Some crazy thing may make it into said standard and we’ll all be using 1 tab and 2 spaces. Or even worse, we might need to default to k&r function definitions. Yuck!

        Standards are good because things become uniform but are also bad because they are the defacto lowest common denominator.

        1. 1

          But most of the commonly used C/C++ coding standards are at least readable, even k&r :) so as long as there aren’t security issues with the if/switch/case/goto usage/braces/indentation then it should be fine, even tabs or weird number of spaces :P No matter which style you, use eventually it will become second nature and all of code will look weird. So hypothetically it would be great if those other styles didn’t even compile.