Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: void casts; and C definition question Message-ID: <3231@utzoo.UUCP> Date: Tue, 4-Oct-83 19:12:07 EDT Article-I.D.: utzoo.3231 Posted: Tue Oct 4 19:12:07 1983 Date-Received: Tue, 4-Oct-83 19:12:07 EDT References: <5873@watmath.UUCP>, <327@wjh12.UUCP> Organization: U of Toronto Zoology Lines: 21 A while ago, I exchanged mail with DMR about the question of whether neglecting to declare the type of an unused return value was a sin. The C book does say that awful things may happen if you get the type wrong (explicitly or implicitly) and use the value, but it is silent on the subject of return values that are merely discarded. Dennis's comments (as nearly as I remember them) were, roughly: "There has been no firm decision on this. It would be a lot cleaner to require proper declaration, but it would break many, many existing programs. There is also an argument which says 'if you don't use it, why should you need to declare it?'." I believe the pragmatic issues involved made him lean toward being permissive about this. It does make life harder for compiler writers, especially with structure returns. About the only thing you can do if your machine is especially recalcitrant is to have the compiler quietly generate an extra little function for each "real" function, with the extra function calling the real one and then properly discarding the returned value. The compiler then calls either the real function or the extra, depending on whether the returned value is used by the particular call or not. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry