John Regehr on "Use of Assertions"

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Sep 5 10:30:46 UTC 2018


On Monday, 3 September 2018 at 16:53:35 UTC, Meta wrote:
> This battle has been fought over and over, with no movement on 
> either side, so I'll just comment that nobody what John Nails 
> or anyone else says, my personal opinion is that you're 100% 
> wrong on that point :-)

Well, John Regehr seems to argue that you shouldn't use asserts 
for optimization even if they are turned on as the runtime might 
override a failed assert.

«As developers, we might want to count on a certain kind of 
behavior when an assertion fails. For example, Linux’s BUG_ON() 
is defined to trigger a kernel panic. If we weaken Linux’s 
behavior, for example by logging an error message and continuing 
to execute, we could easily end up adding exploitable 
vulnerabilities.»

So…



More information about the Digitalmars-d mailing list