🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #488

KPL & SSUN signal() confusion

#488
From: gwyn
Date: Thu, 05 Feb 1987 17:53
38 lines
2635 bytes
The November 1986 UNIX System Support & Update News Call # 235493
and the January 1987 UNIX System V Known Problem List Problem ID 947
both give an incorrect description of the change made to the type
returned by signal() in SVR3.0.  This function returns (void *()),
not (void *) as reported in the AT&T bug notes.  The mention of the
fact that previous C compilers do not support (void *) is totally
irrelevant.

Here's what is actually going on.  Due to the very nature of user
signal handler functions, they have no place to return a value to,
so their return type is properly (void).  However, older UNIX C
compilers did not have a (void) data type; functions that didn't
return values were then conventionally left to default to (int)
return type.  Consequently, the only way to describe the return
value of signal() was as (int *()).  With the introduction of
(void), it became possible to properly declare signal handler
functions, so the proper return type for signal(), (void *()),
could now be expressed.  However, due mostly to inertia the change
was not made in many places (notably <signal.h>) for a long time.

X3J11 made a serious effort to clean up the types of library
function parameters and return values.  The last two significant
type botches to be straightened out were for signal() and onexit()
(later renamed atexit()).  IEEE P1003 eventually went along with
the change, and AT&T finally picked it up for the SVID and SVR3.0.

Note that on most architectures the type mismatch between an "old"
signal handler type declaration and the "new" correct one has no
practical effect other than generation of warning messages by the
compiler and "lint".  However, since C is currently able to express
the correct type, one should use it.

People using compilers derived from the 4.2BSD compiler may have
a problem, since that version (lifted from an internal AT&T version
around the time of USG 3.0) doesn't fully understand functions that
return void; in particular it can't handle pointers to such
functions.  This makes it hard to use the correct signal() type!
Such compiler bugs should be fixed (as this one was for 4.3BSD).
Technical Details
Message-ID: <5593@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!brl-adm!brl-smoke!gwyn

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.UUCP
Newsgroups: comp.bugs.sys5
Subject: KPL & SSUN signal() confusion
Message-ID: <5593@brl-smoke.ARPA>
Date: Thu, 5-Feb-87 12:53:36 EST
Article-I.D.: brl-smok.5593
Posted: Thu Feb  5 12:53:36 1987
Date-Received: Sat, 7-Feb-87 13:24:46 EST
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 38