Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: optimizing assert Message-ID: <2348@haddock.ISC.COM> Date: 20 Jan 88 20:20:09 GMT References: <11295@brl-adm.ARPA> <2300@haddock.ISC.COM> <2662@mmintl.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 21 In article <2662@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: >In article <2300@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes: >>If the expression has side effects, I think it's clear that the user does >>want them to be evaluated. > >This is fine as long as the assert expression calls no functions. ... >[But what about] assert(pow(x, 2) < y) Good point. I was thinking in terms of functions with desirable side effects, in particular things like assert(getchar() == '\n') . Okay, world. Do you use ? Do you have any/much existing code that uses benign function calls within assert? Is it worth "breaking"% that code in exchange for the added benefit of being able to use arbitrary expressions with impunity? Send mail; I'll post a summary. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint %The proposed change wouldn't invalidate such a program, but it would probably cause extra code to be generated/executed.