Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site wjh12.UUCP Path: utzoo!linus!vaxine!wjh12!kendall From: kendall@wjh12.UUCP (Sam Kendall) Newsgroups: net.lang.c Subject: Re: void casts; and C definition question Message-ID: <327@wjh12.UUCP> Date: Sat, 1-Oct-83 17:02:51 EDT Article-I.D.: wjh12.327 Posted: Sat Oct 1 17:02:51 1983 Date-Received: Sun, 2-Oct-83 22:45:09 EDT References: <5873@watmath.UUCP> Organization: Delft Consulting Corp., New York Lines: 26 The complaint is that (void) f(); is a kludge, that (*(void (*)()) f)(); /* or something like that */ is the "real" way to do the former. Well, I there is nothing wrong with the former. A void cast means "throw away a value". An interesting point here is that the latter is not even guaranteed to work in the C language. Calling a function with an incorrectly specified type usually works, but on some compilers (National Semiconductor's 16032 C compiler, for instance), if f() returns a structure, then it must be declared to do so for a call to work, since the address of where to put the return value is passed as the first arg of the function. Many programs do not declare the return type of functions correctly; for instance, it is common to leave off a char *strcpy(); definition if the return value is never used. My question is this: What should the language say about calling functions with incorrectly declared return values? We cannot guarantee that it will work with functions returning structures. But should it otherwise? Many programs (unfortunately) depend on it. Sam Kendall {allegra,ihnp4}!wjh12!kendall Delft Consulting Corporation decvax!genrad!wjh12!kendall