Newsgroups: comp.lang.c
Path: utzoo!utgpu!watserv1!watmath!datangua
From: datangua@watmath.waterloo.edu (David Tanguay)
Subject: typedefing functions (Re: Is typedef char BUFFER[20] legal?)
Organization: University of Waterloo
Date: Mon, 4 Feb 91 05:36:13 GMT
Message-ID: <1991Feb4.053613.3758@watmath.waterloo.edu>
Followup-To: comp.std.c
References: <1212@tredysvr.Tredydev.Unisys.COM> <1991Jan29.210100.8105@zoo.toronto.edu> <22642@netcom.UUCP> <1991Feb3.000128.15980@zoo.toronto.edu>
Lines: 19

In article <1991Feb3.000128.15980@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>Nope, syntax error.  Typedef is semantically a special case, but not
>syntactically:  a type declaration looks *exactly* like a declaration
>of an ordinary variable except for that funny word "typedef" on the
>front.

Our compiler had a neat bug with this. It would accept, e.g., 

	typedef int f( int a ) { return a+1; }

"f" would be a type thereafter in that file, but it was also created as
an external visible only outside that file. Syntacticly typedef is the
same as static or extern.

Is the above typedef valid in ANSI-C (as a typedef)? It's not a valid
function declaration (has to be static or extern), but I can't recall
anything making it an invalid typedef.
-- 
David Tanguay            Software Development Group, University of Waterloo
