Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lsuc.UUCP Path: utzoo!lsuc!msb From: msb@lsuc.UUCP (Mark Brader) Newsgroups: net.lang.c Subject: Re: When does void make code less readable? Message-ID: <420@lsuc.UUCP> Date: Sun, 17-Feb-85 12:46:26 EST Article-I.D.: lsuc.420 Posted: Sun Feb 17 12:46:26 1985 Date-Received: Sun, 17-Feb-85 15:01:26 EST References: <1995@sun.uucp> Reply-To: msb@lsuc.UUCP (Mark Brader) Distribution: net Organization: Law Society of Upper Canada, Toronto Lines: 31 Summary: When the return value doesn't have to be used. Consider the function strcpy. The manual here declares this as: char *strcpy(s1, s2) char *s1, *s2; The return value here is just a copy of the input value s1, provided on the off-chance that it'll be useful to the calling program. I claim that all functions that don't otherwise return a value should strive to return a might-be-useful value. Then when you see a function call whose result is unassigned, you know a return value is being ignored. I think (void) should be reserved for really unusual cases, as documentation that you really meant to do that. I do support the use of lint, but I don't like (void). It just clashes with the language's style, to my mind. After all, we can write: a = ++b; or: ++b; but I don't want to write the latter as: (void) ++b; everywhere. What's the difference between this an a function call: increment(&b); ? Mark Brader