From 7607053412664068105
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: David R Tribble <dtribble@technologist.com>
Subject: Re: nested functions
Date: 1999/06/17
Message-ID: <37681965.87E5D3D0@technologist.com>#1/1
X-Deja-AN: 490588656
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7jd4c5$nup$1@nnrp1.deja.com> <7jjjr6$r02$1@nnrp1.deja.com> <7jma5c$i85@abyss.West.Sun.COM> <FD38vK.CC4@research.att.com> <7jrpss$ogk$1@nnrp1.deja.com> <FqA83.38464$wk2.553149@newscene.newscene.com> <37659D89.565ACF7D@technologist.com> <7k5ncv$n8u$1@nnrp1.deja.com> <376690B6.6231FB13@technologist.com> <376761DB.603FE6F1@physik.tu-muenchen.de>
X-Original-Date: Wed, 16 Jun 1999 16:38:45 -0500
X-Accept-Language: en
X-Authentication-Warning: backdraft.briar.org: smap set sender to <news@beasys.com> using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 929607477 18431 128.250.29.16 (17 Jun 1999 08:17:57 GMT)
Organization: Member of the Vast Right-Wing Conspiracy
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBEAgUAN2ivH+EDnX0m9pzZAQHqyAF4oDKZVhdrsoO5tHETeH/8WP+lGZ5GxZP/ xMUI7UtsF4DHmOQ7is4mwenXG/eFLwc= =VXWM
Mime-Version: 1.0
NNTP-Posting-Date: 17 Jun 1999 08:17:57 GMT
Newsgroups: comp.std.c++

Christopher Eltschka wrote:
> 
> David R Tribble wrote:
>> What is hard is adding yet another kind of function pointer, which
>> allows the compiler to properly invoke a pointed-to local function
>> so that its invocation frame is properly constructed.  I'm led to
>> the conclusion that the compiler needs to know it's a local
>> function pointer, distinct from a "normal" function pointer, so that
>> this can occur; this implies a new syntax for distinguishing between
>> the two kinds of pointers.  (I already suggested the syntax
>> '({}::* fp)()' in another post.)  Such a pointer must contain extra
>> information such as the number of nesting levels needed by the
>> pointed-to function's display; perhaps such a pointer points to
>> a static "display descriptor" which contains such information,
>> much like an object's _vtbl pointer points to a static "class
>> descriptor table".
> 
> This is the most obvious solution. However, another solution exists
> which encodes the extra information not in the pointer itself, but
> in the code it points to, which is a dynamically created trampoline.
> That solution has the advantage that you can use normal function
> pointers, and pass them to non-C++-functions.

There are undoubtedly architectures upon which you cannot create
trampolines "on the fly".  So this solution is probably not
suitable for the standard.  That's one reason I'm led to believe,
still, that nested function pointers are inherently different
critters than regular function pointers.

(And I still don't think nested functions are that useful.
So there.)

-- David R. Tribble, dtribble@technologist.com --
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



