Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!wjh12!talcott!harvard!seismo!umcp-cs!chris
From: chris@umcp-cs.UUCP (Chris Torek)
Newsgroups: net.lang.c
Subject: Re: Function pointer syntax peculiarity
Message-ID: <1461@umcp-cs.UUCP>
Date: Thu, 29-Nov-84 16:29:12 EST
Article-I.D.: umcp-cs.1461
Posted: Thu Nov 29 16:29:12 1984
Date-Received: Sat, 1-Dec-84 06:48:46 EST
References: <396@ucsfcgl.UUCP>
Organization: U of Maryland, Computer Science Dept., College Park, MD
Lines: 44
I think this has been mentioned before. PCC accepts almost anything as
a function. Try
f(g)
int (*g)();
{
(**********g)(1);
}
for example.
I personally think it makes perfect sense to say
f(g)
int (*g)();
{
g(1);
}
but this breaks the nice consistency between the way a variable is
declared and the way it is used. (It makes sense since a function
name by itself is a pointer to that function; that is, I write
main()
{
int (*f)();
int foo();
f = foo; /* &foo is wrong */
foo(6);
(*f)(6); /* but f(6) is wrong too */
}
If & and * are inverses, I should be saying either "f = &foo" or
"f(6)", and I should be able to say "(*(&foo))(6)".)
However, "(*f)()" is correct, and it's a bug/feature that
PCC accepts other forms.
--
(This line accidently left nonblank.)
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (301) 454-7690
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris@umcp-cs ARPA: chris@maryland