ANSI assert

Henry Spencer henry at zoo.toronto.edu
Sun Sep 9 11:05:14 AEST 1990


In article <1428 at proto.COM> joe at proto.COM (Joe Huffman) writes:
>... I have many places in my code where I
>do something like the following:
>
>  assert(i++ < limit);

This is unwise, and has been from the start.  Many implementations of
<assert.h>, including the V7 one (the original, I think), do not evaluate
the operand at all when NDEBUG is defined.

The final ANSI C document, by the way, *specifically states* that when
NDEBUG is defined, assert() is defined as

	#define	assert(ignore)	((void)0)

and nothing else.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.std.c mailing list