Newsgroups: comp.std.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: typedefing functions (Re: Is typedef char BUFFER[20] legal?)
Message-ID: <1991Feb4.185409.7034@zoo.toronto.edu>
Organization: U of Toronto Zoology
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>
Date: Mon, 4 Feb 1991 18:54:09 GMT

In article <1991Feb4.053613.3758@watmath.waterloo.edu> datangua@watmath.waterloo.edu (David Tanguay) writes:
>	typedef int f( int a ) { return a+1; }
>
>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.

It's not a valid typedef because that `{ return a+1; }' cannot appear in
a declaration of any kind.  The presence of the function body makes this
a function definition, not a declaration, and `typedef' is not legal in
a function definition.
-- 
"Maybe we should tell the truth?"      | Henry Spencer at U of Toronto Zoology
"Surely we aren't that desperate yet." |  henry@zoo.toronto.edu   utzoo!henry
