News for hackers. Stuff that matters.
Re:Assert() in the hands of bad coders by jasode on Tuesday March 28, 2017 @09:30AM (#13976380)
> bugs that have been very difficult to find, as they were 'fixed' by side effects of assert statements and hence didn't show up in debug builds.

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:

  #if _DEBUG    // or #ifndef NDEBUG
    std::cerr << "inspect size: " << invoices.size() << std::endl;
    // more debugging-related code ...
  #endif
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.
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.
Re:Assert() in the hands of bad coders by wruza on Wednesday March 29, 2017 @04:42AM (#13984416)
stderr is usually not buffered anyway.
Re:Assert() in the hands of bad coders by dllthomas on Wednesday March 29, 2017 @04:45AM (#13984424)
Usually.