🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2611

Re: proper semi-portable use of signal()?

#2611
From: Guido van Rossum
Date: Wed, 27 Mar 1991 09:18
27 lines
1365 bytes
In article <3223@charon.cwi.nl> I asked:

>>... the declaration for signal() in <signal.h> looks as follows:
>>	extern void	(*signal(int, void (*) (int, ...)))(int, ...);
>>
>>[gcc complains about:]
>>	#include <signal.h>
>>	void (*sigsave)();
>>	...
>>	signal(SIGINT, sigsave);

Norman Diamond replies:

>You did not declare void (*sigsave)(int, ...);

Indeed, but I believe my code conforms to the Standard: 4.7.1.1 lists
the second argument of signal() as void (*func)(int), not as void
(*func)(int, ...).  I thought varargs (sorry, stdarg) functions *had*
to be declared with prototypes, while for functions with fixed
argument lists, old style declarations were also acceptable.

Therefore I believe my declaration is compatible with the standard,
while the <signal.h> in question (provided by SGI) is not.  Any other
opinions?

--Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
"The life of a Repo Man is always intense"
Technical Details
Message-ID: <3228@charon.cwi.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!charon!guido
References: <3223@charon.cwi.nl> <1991Mar27.014048.18198@tkou02.enet.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!charon!guido
From: guido@cwi.nl (Guido van Rossum)
Newsgroups: comp.std.c
Subject: Re: proper semi-portable use of signal()?
Message-ID: <3228@charon.cwi.nl>
Date: 27 Mar 91 09:18:23 GMT
References: <3223@charon.cwi.nl> <1991Mar27.014048.18198@tkou02.enet.dec.com>
Sender: news@cwi.nl
Lines: 27