Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
You did already use -Wall -Wextra, right? Also remember that signed integer overflow is undefined behaviour in C/C++, unless you relax the compiler about that one to not handle it strictly.
-
@Fast-Nop I let CLion do the compiler settings, I didn't think about tweaking it myself
That's what I told myself, reason why I came up with a fix removing the overflow, but for some reason it doesn't seem to change much -
@highlight
int pos = 1000 - (int) x; // x is unsigned, and obligatorily lower or equal to 1000
file.seekg(-pos, std::ios_base::cur); -
hjk10157315yYou sure it's not a race condition? That is something often random and a heisenbug if you already checked the under/overruns.
Ranted earlier about how my debugger was fucking up. Jokes on me, it's now the only thing that works well.
The fucking C++ code behaves normally in debug build, but when in release build throws a SEGFAULT out of nowhere. Bet it's tellg() or my unsigned to signed conversion that fuck things up (while they work perfectly in debug, I repeat). But I can't tell, since the only way I have to trace back the issue is the disassembly ¯\_(ツ)_/¯
rant
c++ wants my death