Thread (16 messages) flat view 16 messages, 3 authors, 2017-11-23

Re: [PATCH 1/3] Documentation/CodingGuidelines: explain why assert is bad

From: Jonathan Nieder <hidden>
Date: 2017-11-22 23:54:34

Stefan Beller wrote:
On Wed, Nov 22, 2017 at 2:59 PM, Jonathan Nieder [off-list ref] wrote:
quoted
In a certain ideal world, the preference would be reversed: you'd want
to use assert() wherever you can and require the compiler to check
that all assert()s are verifiable at compile time.  A check that a
static analyzer can verify is more valuable than a run-time check.
When a compile-time check is not possible, you'd have to fall back to
BUG_ON().
Linux has BUILT_BUG_ON as well, which we may desire?
I thought so until I tried to use it:
https://public-inbox.org/git/20170830065631.GH153983@aiede.mtv.corp.google.com/

So I think we are stuck with run-time checking for now.

Thanks,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help