🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2379

Re: typedefing functions (Re: Is typedef char BUFFER[20] legal?)

#2379
From: Richard Kooijman
Date: Tue, 05 Feb 1991 17:28
45 lines
1559 bytes
henry@zoo.toronto.edu (Henry Spencer) writes:

>In article <ENAG.91Feb4192806@holmenkollen.ifi.uio.no> enag@ifi.uio.no (Erik Naggum) writes:
>>you can say
>>	typedef int f (int a, char *b);
>>and later say
>>	f foo, bar, zot;
>>and
>>	f *functab[3] = { foo, bar, zot, };

>Correct so far.

>>The functions would be declared
>>	f foo
>>	{ ... }

>Nope, wrong.  The function definition itself must contain an explicit
>function declarator; it cannot inherit its "functionness" from a typedef.
>See Constraints in 3.7.1.

But what is the reason? I think it severely limits the use of
typedef'ing functions, which could be otherwise very useful:

typedef void cntrlc_handler(void);

main()
{
	cntrlc_handler c_handler;

	signal(SIGINT, c_handler);
}

It is a shame to be forced to define c_handler again:


void c_handler(void)
{
   ...
}





Richard.
Technical Details
Message-ID: <1213@duteca.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!hp4nl!duteca!kooijman
References: <1212@tredysvr.Tredydev.Unisys.COM> <1991Jan29.210100.8105@zoo.toronto.edu> <22642@netcom.UUCP> <1991Feb3.000128.15980@zoo.toronto.edu> <1991Feb4.053613.3758@watmath.waterloo.edu> <ENAG.91Feb4192806@holmenkollen.ifi.uio.no> <1991Feb4.234441.17203@zoo.toro

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!hp4nl!duteca!kooijman
From: kooijman@duteca (Richard Kooijman)
Newsgroups: comp.std.c
Subject: Re: typedefing functions (Re: Is typedef char BUFFER[20] legal?)
Message-ID: <1213@duteca.UUCP>
Date: 5 Feb 91 17:28:44 GMT
References: <1212@tredysvr.Tredydev.Unisys.COM> <1991Jan29.210100.8105@zoo.toronto.edu> <22642@netcom.UUCP> <1991Feb3.000128.15980@zoo.toronto.edu> <1991Feb4.053613.3758@watmath.waterloo.edu> <ENAG.91Feb4192806@holmenkollen.ifi.uio.no> <1991Feb4.234441.17203@zoo.toro
Organization: Delft University of Technology, Netherlands
Lines: 45