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

What is the advantage of your assume macro over regular C11 static_assert / assert? Apologies if it is immediately obvious.

And in case anyone else is wondering, the advantage of that m_max macro is that it evaluates each of its arguments only once.




The types of things that _Static_assert takes is substantially more limited than this construct, as it can only take an "integral constant expression" which is in practice basic integer arithmetic and nothing else. This construct works with more complicated things that are nonetheless known at compile time, such as "asdf"[4] (should be 0).




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: