14

Windows decides to finish faulty programs whenever it likes. İt's so annoying, I did just one small mistake in c++. I wrote "new char(length);" instead of "new char[length];" and I have been dealing with this shit for three days. Then I run the program on Linux and boom it failed in the same spot, which I fixed. But in Windows it sometimes runs, sometimes fails or sometimes even fails on unrelated places. Wtf windows? How about security and shit. There was literally a buffer overflow and you still keep running the program. And why GCC didn't even popped a warning. I hate developing c :(

Comments
  • 2
    Why it has anything to do with windows?
  • 2
    @sunfishcc because program fails on random locations in Windows only. But if I run it on Linux it fails on that specific line. Which means windows keeps executing code that has a buffer flow in it. İt's wrong both in terms of security and development
  • 0
    @yunusgnr what did visual studio debugger say?
  • 1
    @sunfishcc I am using gcc from console, because I use c with golang which visual studio can not compile. Also I don't like to use ide. And prefer running it from the console directly
  • 1
    @yunusgnr I used to complete my assignment using CodeBlock long times ago, then switch to Qt, then VS. The project is bigger, but it saves lots of time for debugging.
    Not familiar with golang though
    If you try to practice code competition, then it's a different scenario.
  • 0
    @sunfishcc i don't want to deal with compiler flags inside an ide its so hard to set it up. Thank God for automake on Linux. I know this is going to sound cocky but I can write a simple PowerShell script instead of using an ide which also helps with continuous Integration.
  • 3
    I've noticed that too. Not with my programs. With others'. But the principle stands - some errors are not triggered [makes me wonder what magic is running in errorneous spots], some are triggered randomly.

    I can't stand this random magic and undefined behaviours. Call me a control freak, but I need os to be reliable all the time. Not randomly
  • 4
    Undefined behaviour allows ANYTHING. Also, undefined behaviour is in no way bound to fail where it occurs. It can also occure way after the line. Or even before the line.

    Don't like undefined behaviour? Then don't use C(++). Go for a managed language.
Add Comment