Hacker News new | ask | show | jobs
by dataflow 4 days ago
> An assert goes into the body of a function (.cpp)

I think you're forgetting function bodies are often in headers? Both for intentionally inline functions, and also for most templates because they're forced to. We've quite literally had this problem for decades. And even a far more severe version of it where people add NDEBUG-only fields to a class. And also with things like hardening macros, etc. I don't see why this case is suddenly the dealbreaker now. Especially because contacts are supposed to lack side effects, so it shouldn't matter what implementation is picked even if it's totally random.

1 comments

Typo, I meant non-NDEBUG-only.