ANSI assert

Doug Gwyn gwyn at smoke.BRL.MIL
Mon Sep 10 07:21:14 AEST 1990


In article <159 at thor.UUCP> scjones at thor.UUCP (Larry Jones) writes:
>Code with side-effects in
>an assert argument was generally agreed to be perverse at best.

I don't know that it was "generally agreed"; one can reasonably argue
either side of this issue from the point of view of programming.
However, existing implementation practice was clearly on the side of
not evaluating the argument in the NDEBUG case; by requiring that
method of implementation, the standard guarantees wider usage of
assert() than would be safe were it left undefined whether or not the
argument is evaluated.  (A previous poster gave an example of this.)



More information about the Comp.std.c mailing list