I’m new to C++, as many people in this subreddit are, so of course I’ve been running into many problems, but there’s this one problem I keep running into that I never really solve: I’ll make a little chunk of code, compile it, and then see that it isn’t behaving as I want it to. So naturally I turn on the debugger and step through the relevant lines to see what’s going wrong. But that’s just the thing, whenever I check line by line it behaves correctly, even if I just execute the code without any breaks in the debugger it runs completely as expected. So then I compile again, and it still isn’t working as expected. Why could this be? I’ve seen people mention that optimisations could be causing this, but I’ve attempted turning off all optimisations and it has no effect. Thank you for helping. https://omegle.onl/
If you want help, you have to be more specific in your request:
- We don’t know what you are trying to do (related to Codingame or not ?).
- We don’t know what environment (OS, IDE…) you are using.
- We don’t know what mean “not work as expected” in your case.
- And so on.
And what is this omegle link ?
You might have undefined behaviour in your code somewhere. Check for things listed here in your code and read into memory safety and undefined behavior. Make sure to read any warnings given by your IDE/linter/static analysis tools. Most compilers have flags for enabling extra checks and warnings (e.g. if using clang you might want to try compiling with -fsanitize=address,undefined -g -Wall -Wextra
) but they won’t always be caught since certain patterns in C/C++ are undefined by design.
1 Like