Comment by fc417fc802
4 days ago
I don't know if it's good practice but I replace assert and assert.h with my own code (you just have to make sure to make the necessary platform specific calls in your replacement headers). So I always know exactly how assert will behave in my own codebase even when invoked by a library.
It's worth noting that the motivation for the above was poorly written libraries that hardcode the use of the builtin assert. So I agree with you completely on that point.
That said I've never been particularly impressed with how assert is defined by the standard and now somehow contracts appear set to be even worse.
Now you know. It's VERY bad practice.
I don't see how. It's certainly not encouraged but then I'm doing it to work around the bad practice of others so what do you expect?
Why do you not simply define your OWN version of assert with a different name?
It's very bad practice because you have altered the behavior of the standard library.