Path: utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!elroy!ames!umd5!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.lang.c Subject: Re: optimizing assert Message-ID: <8001@elsie.UUCP> Date: 21 Jan 88 18:07:28 GMT References: <11295@brl-adm.ARPA> <2300@haddock.ISC.COM> <2662@mmintl.UUCP> Organization: NIH-LEC, Bethesda, MD Lines: 18 Summary: $0.02 Up to a year ago, I believed that the ANSI standard should set things up so that the "argument" of assert was always evaluated--even when NDEBUG was defined. Now that I worry more about "following existing practice," I believe that assert's argument should *not* be evaluated when NDEBUG is defined, since most existing implementations don't evaluate it. Which needn't stop the committee from tossing the lines #if defined NDEBUG #define demand(x) ((void) (x)) #else /* !defined NDEBUG */ #define demand(x) assert(x) #endif /* !defined NDEBUG */ into "assert.h" (with suitable documentation). (Failing that, you can toss the lines into your own code.) -- ado@vax2.nlm.nih.gov ADO, VAX, and NIH are Ampex and DEC trademarks