Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!think!ames!hc!beta!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Assigning to Pointers Message-ID: <5855@brl-smoke.ARPA> Date: Wed, 13-May-87 12:51:25 EDT Article-I.D.: brl-smok.5855 Posted: Wed May 13 12:51:25 1987 Date-Received: Sat, 16-May-87 05:57:15 EDT References: <3537@vrdxhq.UUCP> <857@killer.UUCP> <6611@mimsy.UUCP> <266@sjoerd.cs.vu.nl> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 29 In article <266@sjoerd.cs.vu.nl> sjoerd@cs.vu.nl (Sjoerd Mullender) writes: >In article <6611@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >>Actually, the return value from signal is not representable, >>as it is `pointer to function returning pointer to function >>returning pointer to function returning ...', with no final >>type. Instead, we all cheat and use `pointer to function >>returning int' (or, in some cases, `returning void'). >We'll all agree that signal returns a pointer to some sort of function. >That function is the signal handler for a certain signal. This means >that it is int function (or sometimes void). So signal is a function >returning a pointer to a function returning int (or void). >In other words: > int (*signal())(); Sjoerd is right, except that the return type of a signal handler function is void, not int. Use of int dates back to the days before there was a void type; we have finally in the past couple of years gotten the standards to agree that void is the correct type. There are still several implementations that haven't updated their signal.h, however. I don't know what Chris had in mind. The only standard function I've seen in recent years that had such a problem with recursive type was the X3J11 onexit() function, which registered functions to be called upon exit. Each such function was supposed to keep track of the next in the chain, which is where the recursive type came from. Fortunately we managed to get this function changed to atexit() which has a much simpler inerface. If you were to consider the parameter types as part of a function's type, then signal() would of necessity have recursive type.