Am Sa., 23. Mai 2020 um 22:51 Uhr schrieb Paul Eggert <egg...@cs.ucla.edu>: > > On 5/23/20 10:38 AM, Marc Nieper-Wißkirchen wrote: > > But if "affirm" is fine with you, I would love to see it in a module. > > Either in verify or assure or in a new module named affirm. > > Something like the attached?
That would be a good addition to Gnulib, indeed, I think. (And may even already be used by a number of modules, which currently call abort explicitly.) I find the comments in your code very valuable. I may change only one thing. Above the definition of affirm, you write "Unlike standard 'assert', this macro always compiles E even when NDEBUG is defined ...". I think it is better to change it to "... always evaluates E even when ...". In fact, when the assumption is fulfilled, E must have been evaluated. If the assumption fails we are in the realm of undefined behavior, so we may as well claim that E has been evaluated. This is important not only so that the side effects of the evaluation of E are documented, but also to remind the user of a potentially costly evaluation.