[DiscordArchive] what could cause a C++ program to have some bugs when compiled by someone else ?
[DiscordArchive] what could cause a C++ program to have some bugs when compiled by someone else ?
Archived author: Skarn • Posted: 2022-12-23T07:14:42.602000+00:00
Original source
Uninitialised integers may contain any value and are illegal to read/write from until they are initialized (that's called indeterminate value).
Archived author: Skarn • Posted: 2022-12-23T07:15:52.899000+00:00
Original source
The other compiler or configuration may have that memory 0ed by accident, but you can't rely on that. Just initialize that stuff properly in a class constructor.
Archived author: Deamon • Posted: 2022-12-23T07:23:06.129000+00:00
Original source
The worst thing is when you write past pointer boundaries thus corrupting the heap, and you get a random exception somewhere in the app, where it could not happen like at all
Archived author: robinsch • Posted: 2022-12-23T07:27:52.344000+00:00
Original source
Hell yes, had to run valgrind on live server which is 10x or even worse performance cut to find out of bounds write
Archived author: robinsch • Posted: 2022-12-23T07:29:01.999000+00:00
Original source
would just crash in random places, but only took a few hours until some sneaky person used "some opcode" to write out of bounds, still possible to crash any AC server and it will not generate a valid crashlog for you :[