Thread View: comp.bugs.sys5
3 messages
3 total messages
Started by gwyn
Thu, 05 Feb 1987 17:53
KPL & SSUN signal() confusion
Author: gwyn
Date: Thu, 05 Feb 1987 17:53
Date: Thu, 05 Feb 1987 17:53
38 lines
2635 bytes
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).
Re: KPL & SSUN signal() confusion
Author: karl
Date: Sun, 08 Feb 1987 21:41
Date: Sun, 08 Feb 1987 21:41
5 lines
708 bytes
708 bytes
In article <5593@brl-smoke.ARPA> gwyn@brl-smoke.ARPA (Doug Gwyn) writes: >[The signal() function] returns (void *()), not (void *) as reported in the >AT&T bug notes. No, it returns (void (*)()).
Re: KPL & SSUN signal() confusion
Author: gwyn
Date: Wed, 11 Feb 1987 05:51
Date: Wed, 11 Feb 1987 05:51
4 lines
695 bytes
695 bytes
In article <372@haddock.UUCP> karl@haddock.ISC.COM.UUCP (Karl Heuer) writes: >No, it returns (void (*)()). Quite right; sorry.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads