Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How? The assert() has no special significance to the compiler at all, it's just code. Usually it's just an empty macro for non-debug builds.

I guess you could define your assert() use [[assume]] in C++ for non-debug builds... but that seems like a very bad idea to me.

Just leave the asserts in prod. They almost certainly don't have measurable overhead. The few that do can be dealt with separately.

The Linux kernel has thousands of asserts which are always checked at runtime (BUG_ON).



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: