89

OKAY WHAT THE FUCK

Comments
  • 2
  • 1
    Maybe the build is broken?
  • 3
    wht is the editor though that looks like paper?
  • 45
    Oh, come on, do you really miss your mistake on that one line of code?

    Ok then:
    You omitted a return value on a function returning an int. That results in undefined behaviour. In your case it leaves 0x8B as result for the environment starting your program.
    Next time it may be some other value. It may even be 0, so it might look ok, but the code would still be wrong.
  • 2
    @vexusia damapafil is the new agile
  • 5
    @ddephor Yeah, no. Main is a special function in both c and c++ where the return value is optional.

    The issue was in a different area of the project. Even though I deleted all of the #include statements, that code was still built, and gave a segfault.

    I took a minute to realize this myself, and was very fucking angry for a while! Debugging nightmare!
  • 7
    @AlgoRythm the return value is not optional, however would definitely not cause this
  • 5
    @stevemk14ebr It is very much so optional by modern standards.
  • 2
    @AlgoRythm you should write it in. Yea you can omit it and nothing will blow up, but that's a bad habit to get into
  • 1
    @Dimmerworld
    Although the dev might have had.
  • 1
  • 3
    Post it in Stack Overflow and good luck
  • 2
    I think you have wrong cape on your duck... ¯\_(ツ)_/¯
  • 1
    That compiled?
  • 1
    Didn't you read the top?

    Do as much as possible and fix it later
  • 1
    @Dave-Elec if you are asking for the name of the IDE, I assume it's CodeBlocks
  • 0
    @AlgoRythm afaik return value is optional in MSVC compiler. But in GCC that's required
  • 0
  • 0
    im laughing
  • 1
    @Dave-Elec Code::Blocks. Its a shit.
  • 1
    @finncyr You can't just say it's shit. It is probably the best open source C/C++/Fortran IDE. Though it lacks a lot of features (e.g. alt + click = go to definition), it is one of the fastest tools for writing and testing your functions.
  • 2
    @finncyr @milleringer That's like saying Notepad++ is shit. It's basic and old but you still know damn well it's one of the best editors out there. I just prefer something more fancy, like sublime.
  • 0
    @AlgoRythm I just wanted to say that no one has the right to say anything is shit without previously giving at least one good argument. Why would anyone be expressing him/herself like that? Not worth those precious zeros that had to be rewritten on the server :)
  • 2
    @milleringer Well, simply, because people are allowed to have opinions, no matter how uninformed or how much you disagree with them.
  • 1
    @milleringer And, to be clear, in the United States at least, everyone has that right.
  • 1
    Sometimes the build system gets confused about a timestamp on some source file and doesn't recognize that it needs to recompile it. It's become standard practice that if something like happens to just delete all the object files.

    Also, #includes are evil. Someday we won't need them anymore 😁
Add Comment