comp.lang.ada
 help / color / mirror / Atom feed
From: adam@irvine.com (Adam Beneschan)
Subject: Re: Calling through function pointer--syntax question
Date: 6 Jun 2001 09:17:39 -0700
Date: 2001-06-06T16:17:39+00:00	[thread overview]
Message-ID: <b4682ab7.0106060817.240363e3@posting.google.com> (raw)
In-Reply-To: UzaT6.65786$%i7.49756743@news1.rdc1.sfba.home.com

tmoran@acm.org (Tom Moran) wrote in message 
news:<UzaT6.65786$%i7.49756743@news1.rdc1.sfba.home.com>...

> >   P (func (5));       -- IS THIS AMBIGUOUS?
>  It looks quite clear to me.  func(5) should print
> func parameter is  5
> and return a func_ptr, namely func1'access. Then P(func_ptr) should print
> P with function parameter called
> Indeed, when I compile and execute that's what I get.  Why did you worry?

Because there's another possible interpretation of the last call: 
"func" is called with the default parameter, 4, and returns a func_ptr; the
function designated by func_ptr is called with one parameter, 5 [no .all is 
necessary on the function access since there is a parameter list], and 
returns an integer (10); and then the P that takes an integer parameter is 
called with the parameter 10.

I wanted to find out whether this was ambiguous because there are two legal
interpretations, or whether there's a language rule I'm missing that makes one
of the two interpretations impossible, or gives precedence to one over the
other.

				-- thanks, Adam



  reply	other threads:[~2001-06-06 16:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-05 17:43 Calling through function pointer--syntax question adam
2001-06-05 19:39 ` tmoran
2001-06-06 16:17   ` Adam Beneschan [this message]
2001-06-06 16:00 ` Tucker Taft
2001-06-06 22:06   ` Adam Beneschan
2001-06-07  1:22     ` Jeffrey Carter
2001-06-08 21:34       ` Adam Beneschan
2001-06-09  6:29         ` Simon Wright
2001-06-11 13:08           ` Philip Anderson
2001-06-11 17:34         ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox