Ew.
The actual change I made was to remove the assertion, add the new if/early-out, and write a 3 paragraph comment on why it was changed and when :-)
We don't need no stinkin' assertions
As an alternative solution:
if (importantPointer == nullptr) return; // keep all existing code assert(importantPointer != nullptr); ....
That just leads to stuff like this (which I've actually seen in production code:
if (thing)
{
assert(thing);
}
else
{
assert(!thing);
}
As an alternative solution:
if (importantPointer == nullptr) return; // keep all existing code assert(importantPointer != nullptr); ....
That just leads to stuff like this (which I've actually seen in production code:if (thing) { assert(thing); } else { assert(!thing); }
Last time I saw that, it was because there was a data race and whoever added the asserts had no idea what was happening.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement