Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!uwvax!uwmacc!uwmcsd1!ig!jade!ucbcad!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Talking of void ... Message-ID: <31905@sun.uucp> Date: Sat, 24-Oct-87 23:11:16 EST Article-I.D.: sun.31905 Posted: Sat Oct 24 23:11:16 1987 Date-Received: Tue, 27-Oct-87 01:32:08 EST References: <1400@mhres.mh.nl> Sender: news@sun.uucp Lines: 28 Keywords: return void cast > This problem occured when I ported a program to a UN*X system on which > signal handlers were "void (*func)()", instead of the usual "int (*func)()". The "usual" type will become "void (*)()" in the future; that is the type specified in ANSI C and thus in POSIX. It is the type used by System V Release 3, and will be used in more systems as time goes on. Had "void" been a part of C all along, the type of a signal handler probably *would* have been "void (*)()", since nobody actually *does* something with the return value of a signal handler (and if somebody built a system where something *was* done with that return value, all hell would break loose, since most people's signal handlers don't return values). > I used a "typedef int SHND_TYPE" in a system-dependent include file, > which I changed to "typedef void SHND_TYPE". But then I ran in problems > with the return *action*, not the *value*: > > SHND_TYPE catchit (...) { > ... some useful code ... > return ((SNHD_TYPE) 0); > } Why are you returning a value here? I know of no UNIX system where the return value of a signal handler is used (and would doubt there *is* such a system, for the reasons listed above). Just put "return;" in place of the existing return statement. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com