Re:Assert() in the hands of bad coders
by marcosdumay on Tuesday March 28, 2017 @11:51AM
(#13977621)
You can't change your program without inserting some kind of side effect.
It may be timing in a multi thread system, extra memory available for an out of bounds array read, or even the CPU being kept busy and heating up or avoiding yielding to some other program.
Re:Assert() in the hands of bad coders
by dllthomas on Wednesday March 29, 2017 @04:36AM
(#13984380)
Your troubleshooting code flushed stderr. That's a side effect, and occasionally it will matter.
stderr is usually not buffered anyway.
In those cases, the assert() was used incorrectly. However, that's not a reason to include the assert code in release builds.
In a similar way, source code will often have troubleshooting code such as:
Just because some programmers mistakenly put unintended side-effects in between the #if_DEBUG/#endif doesn't mean we want that code in the release builds. The purpose of assert() and _DEBUG is to not include them in release builds.