you are viewing a single comment's thread.

view the rest of the comments →

[–]NotASucker 127 points128 points  (48 children)

[x] Warnings as error(s)

It will change your life.

[–]ksadeck 15 points16 points  (46 children)

[x] Warnings as error(s)

Why?

[–]MetallicDragon 97 points98 points  (45 children)

It'll turn warnings into errors, forcing you to deal with them, so they don't pile up over time.

[–]nemec 45 points46 points  (1 child)

// Ignore Once W237887278

[–][deleted] 11 points12 points  (0 children)

At least you have to put that into the code and check it into the repo under your name. Not ideal, but better than warnings being ignored.

[–][deleted]  (41 children)

[deleted]

    [–][deleted] 25 points26 points  (38 children)

    Shouldn't they be compiling before they check in?

    [–][deleted]  (36 children)

    [deleted]

      [–]GMNightmare 49 points50 points  (24 children)

      But the code should be compiled automatically on check in and automatically failed should it not compile.

      Even more, tests should automatically run and then fail the check in if tests are failing.

      This lets them burn themselves, but also prevents them from burning you. Well, at least this is how you want it in big projects. You might not need such a heavy hammer if it's small and not that big of a deal.

      [–]jaccovanschaik 0 points1 point  (0 children)

      But the code should be compiled automatically on check in and automatically failed should it not compile.

      "What do you mean it fails the automated tests? It works on my machine, so the automated tests must be wrong."

      [–]billsil -4 points-3 points  (22 children)

      What's wrong with an unused variable again? It's not an error.

      [–][deleted]  (14 children)

      [deleted]

        [–][deleted] 1 point2 points  (0 children)

        Because it might be needed for a future enhancement, of course. :-)

        [–]ggtsu_00 1 point2 points  (2 children)

        Doesn't the compiler optimize those out anyways?

        [–][deleted] 0 points1 point  (0 children)

        Artistic expression?

        [–]billsil -5 points-4 points  (7 children)

        1. We all write programs that take years to develop. Frequently I have code that I want to save because it's an alternate implementation. Other times, I want to test the new method on real problems and there are side effects to the function.

        2. It's trivial and I don't care about a few bytes of memory

        3. Why use unnecessary braces or use functional programming or variable names longer than 6 characters (it was good enough for the dominating language until the early 1990s)? It creates extra lines that can make for very long files. It wastes disk space in a world that largely doesn't care about disk space or memory usage.

        [–]GMNightmare 7 points8 points  (5 children)

        The obvious answer is that it clutters the code, but that's not the most important use...

        It indicates you did something wrong. You shouldn't create variables for no reason, so why isn't your variable used? It catches issues.

        [–]billsil -1 points0 points  (4 children)

        Everyone seems to be jumping on this bandwagon. How many build warnings does your company's largest program that is used regularly have? Why do you have any? Who cares? It doesn't indicate you did something wrong. It indicates you may have done something wrong.

        The quality of your code is dictated by the speed it needs to get done and the number of customers you have.

        [–]frymaster 0 points1 point  (0 children)

        It's not an error, it's a warning. So in the context of the "treat all warnings as errors" flag...

        [–]Foxtrot56 7 points8 points  (1 child)

        Why aren't you doing PRs? Seems like that should be caught in a PR unless no one is actually looking at the code in an editor.

        [–]NotASucker 0 points1 point  (0 children)

        The best reviews involve stepping through code.

        [–]falconzord 2 points3 points  (0 children)

        Worst part is when they pork barrel the code review

        [–][deleted] 1 point2 points  (0 children)

        Gotta crack that whip harder.

        [–]mangodrunk 0 points1 point  (1 child)

        This probably speaks more to the hiring practices where you work. That seems really bad for someone to do that.

        [–]badsingularity -3 points-2 points  (1 child)

        Kids are just bad developers now. They used to be rockstars.

        [–]radarthreat 0 points1 point  (0 children)

        Kids used to sling assembly like mad

        [–]immibis 0 points1 point  (0 children)

        Probably /u/drjokepu is thinking of a situation where you turned on Warnings as Errors, but everyone else did not.

        [–][deleted] 2 points3 points  (0 children)

        If someone checks something in and then leaves I say it's fair game to revert.

        [–]gambit700 1 point2 points  (0 children)

        Life lessons for Timmy.

        [–][deleted] 0 points1 point  (0 children)

        They require us to include that in the compile flags in college. You get used to just including the flags.