3 ms·
I work at a testing tools company focusing on C/C++, and every few months there's a customer who complains about their tests failing when they toggle a seemingl
by InfiniteRand 6y ago
I work at a testing tools company focusing on C/C++, and every few months there's a customer who complains about their tests failing when they toggle a seemingly unrelated setting. And then we find an uninitalized variable, which means that any random change (for instance, switching from debug to release builds can provoke this) can suddenly cause the variable to have a garbage value.
Fun fact, according to the C/C++ standards, only automatic (local) variables have undefined behavior when uninitialized, globals are supposed to be zero-ed out, however, there are certain platforms and certain compilers where this just doesn't happen, TI actually had a wiki page about how some of their compilers don't do this:
https://web.archive.org/web/20150910234314/https://processors.wiki.ti.com/index.php/Uninitialized_Static_Objects_Not_Set_to_Zero_in_COFF https://web.archive.org/web/20150910234314/https://processor...
- hinkley 6y agoIf you have one bug that doesn’t explain the behavior, you have two bugs. If the behavior makes no sense at all, you probably have three bugs.