Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!husc6!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: questions from using lint Message-ID: <1503@umcp-cs.UUCP> Date: Thu, 15-May-86 04:31:30 EDT Article-I.D.: umcp-cs.1503 Posted: Thu May 15 04:31:30 1986 Date-Received: Sat, 17-May-86 03:34:29 EDT References: <501@brl-smoke.ARPA> <797@bentley.UUCP> <640@bunkerb.UUCP> Reply-To: chris@maryland.UUCP (Chris Torek) Organization: University of Maryland, Dept. of Computer Sci. Lines: 32 In article <640@bunkerb.UUCP> garys@bunkerb.UUCP (Gary M. Samuelson) writes: >If I say "a = b", I have clearly used the value of the expression. Which expression? `b', certainly, but what about the value of `a = b'? The problem is that there really are several `kinds' of expressions in C. All expressions have values; but some are more useful than others. The following are grouped into `error' and `non-error' classes: Error: Non-Error: open("foo", 1); strcpy(hold, s); a + 1; a++; My best guess at the moment at the `true' distinction between the `error' and `non-error' classes is that the latter `end' in side effects. The return value from `open' is usually as important as its side effect; but that from strcpy() is often not. `a + 1' has no side effects in most cases (one where it might is if integer overflow traps are enabled); `a++' has a clear side effect. So perhaps lint needs, in addition to /*VARARGS*/ and /*ARGSUSED*/, and the System V style /*PRINTFLIKE*/, another pragma: /*FORSIDEEFFECTS*/. Routines like strcpy(), strcat(), and perhaps even close(), would be so declared in llib-lc. This would tell lint that the return value, though available, was purely for convenience: that the function is normally called simply for its side effects. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu