Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!ima!necntc!frog!john
From: john@frog.UUCP
Newsgroups: comp.sources.bugs
Subject: Re: problems compiling umoria on SCO
Message-ID: <1944@frog.UUCP>
Date: Thu, 19-Nov-87 18:43:00 EST
Article-I.D.: frog.1944
Posted: Thu Nov 19 18:43:00 1987
Date-Received: Sat, 21-Nov-87 18:51:20 EST
References:  <390@sco>
Organization: Superfrog Heaven [ CRDS, Framingham MA ]
Lines: 41

In article <390@sco>, chapman@sco.COM (Brian Chapman) writes:
> In article 
> jl42+@andrew.cmu.edu (Jay Mathew Libove) writes:
> <   int (*destroy)();
> < 		if (destroy(t_list[c_ptr->tptr.tval))
> correct C is:
> 		if ((*destroy)(t_list[c_ptr->tptr.tval))
> destory is a function pointer.
> (*destory) is a function.

This is a "common" shorthand allowed by compilers. The first form can
have no other meaning, so it isn't really perverting anything.

If I read it correctly, the latest ANSI C definition specifically allows
the shorthand:
"3.3.2.2 Function calls
Constraints
   The expression that denotes the function called shall have type pointer
to function returning void or returning an object type other than array(23).
...
23.  Most often, this is the result of converting an identifier that is a
function designator."

N.B. "3.2.2.1 Lvalues and function designators
...
   A _function designator_ is an expression that has function type. ... a
function designator with type "function returning _type_" is converted to
an expression that has type "pointer to function returning _type_."

(Myself, I've always thought that '(*destroy)' should load the code of the
function into register R0... :-)


--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw@eddie.mit.edu

"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
		-- Johnny Hart