Peter Dimov wrote:
Vladimir Prus wrote:
Yes. assert is not equivalent to perror/abort. The two have different meanings and are not interchangeable.
Care to elaborate why the change cannot be made in this specific case?
assert(expr) means a precondition failure or an internal error, depending on expr.
perror/abort means... perror/abort.
Ah.. you're talking about the meaning attached to the code by the programmer. I was more talking that the effect will be almost the same. Well, it's also possible to write if (!result) { perror(...); assert(...); }
If the problem you are trying to fix is that assert() does not give enough information about the bug - and I haven't seen this particular problem reported as a defect
I interpreted Kevin's post this way -- Boost.Tread fails and does not produce any useful diagnostic.
- the proper way to fix it is to define an user-overrideable callback.
I think you're overgeneralising. If assert prints an error message and exits, then what's the problem with printing one extra diagnostic message before assert? - Volodya