Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!prls!amdimage!amdcad!lll-crg!topaz!bentley!kwh From: kwh@bentley.UUCP (KW Heuer) Newsgroups: net.lang.c Subject: Functions that don't return Message-ID: <665@bentley.UUCP> Date: Wed, 26-Mar-86 13:26:17 EST Article-I.D.: bentley.665 Posted: Wed Mar 26 13:26:17 1986 Date-Received: Sun, 20-Apr-86 11:54:54 EST Organization: AT&T Bell Laboratories, Liberty Corner Lines: 22 The datatype "void" was introduced to distinguish functions which return an int from those which return no useful value but were commonly declared int by default. ("extern f();" still means "extern int f();".) There are a few functions which don't return to the caller at all: exit(), _exit(), and longjmp() come to mind. Many users write their own (usage(), error()). These are normally declared void, which is better than int but still not technically correct. "void" should mean that the function returns, but has no useful value. There should be a new keyword, e.g. "flowsink", to describe a function that never returns at all. I can see three advantages in this scheme. The user is saying what he means, making the code clearer at minimal cost; the compiler would be able to produce slightly more efficient code ("else" following "exit()" could be ignored, like "else" following "goto" or "break"); and lint could dispense with the /* NOTREACHED */ kludge. Comments? Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint