If your code doesn't compile, use `sudo gcc`

  • 4
    No, definitely don't do this, and this is the third low-effort "meme" posted here in the last hour alone.
  • 1
    @junon I think that's why it's in the jokes section.

    Anyways don't do `sudo clang` either.
  • 1
    Pardon my ignorance, but what would running a compiler as su fuck up? Normally it shouldn't touch anything outside the project you're trying to compile, right?
  • 3
    @kamen nothing much. It will create the binaries under root privilege. So the executables or the shared objects will be owned by root instead. The machine won't blow up.

    But if the code is wrong then it won't compile with su either. It's just a joke.
  • 1
    Low effort. Try again
  • 3
    Come on guys, a lame joke won't hurt anyone. I for one like it.
  • 1
    Yeah i find it kinda funny, too 😅

    Btw weakly typed languages are running their compilation with sudo by default ;)
  • 0
    @Lensflare In weakly typed languages writing the code is not satisfactory. It has to be executed and the modified part has to be tested. Then all the tests must pass.

    In C++ many times just compiling is satisfying because many of the decisions are taken at compile time only. If it compiles fine then it has a high probability of working fine. However all tests must pass.
  • 2
    @kamen on it's own not much. If you do it in a production system you might circumvent user imposed limits and therefore high the resources and burying it down.

    When there are makefiles in the mix the are a few dangerous or unexpected situations that can occur. Especially when the suid but it's set without forcing a specific user. The compiled result will run as root always.
    Tools sometimes behave differently as root and can have different output like outputting as message"don't run as root" this might interfere with the Make Magic
  • 1
    @neel-basu I know. I was referring to the concept of sudo in your joke :)
  • 1
    @hjk101 Makes sense, thanks for the explanation.
  • 1
    @hjk101 That's the best explanation I think anyone could have written. Kudos.
Add Comment