[comp.lang.c] typedefing functions

datangua@watmath.waterloo.edu (David Tanguay) (02/04/91)

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