Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site wjh12.UUCP
Path: utzoo!linus!vaxine!wjh12!kendall
From: kendall@wjh12.UUCP (Sam Kendall)
Newsgroups: net.lang.c
Subject: Solution to "A C Puzzle" of 12/12/83
Message-ID: <430@wjh12.UUCP>
Date: Fri, 16-Mar-84 16:42:05 EST
Article-I.D.: wjh12.430
Posted: Fri Mar 16 16:42:05 1984
Date-Received: Sun, 18-Mar-84 01:37:36 EST
References: <374@wjh12.UUCP>
Organization: Delft Consulting Corp., New York
Lines: 21

I posted the following puzzle on 12/12/83:

	For what, if any, subexpressions `p' do the expressions
		*(p)
	and
		(p)[0]
	not have identical meaning?

I received a grand total of two responses, by mail.  One, from
Kenneth Almquist, was correct; the other concluded that there is no
such `p'.

I said that this wasn't a trick question, and I shouldn't have.  The
answer is that for any `p' of type function or pointer to function,
`(p)[0]' doesn't have a meaning.  It expands to `*((p) + 0)', but
pointer addition is illegal for function pointers, because pointer
addition needs to know the size of the pointed-to object, and functions
have no size.

	Sam Kendall		  {allegra,ihnp4}!wjh12!kendall
	Delft Consulting Corp.	    decvax!genrad!wjh12!kendall