From -3818072124443239254
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: nested functions
Date: 1999/06/17
Message-ID: <7kap79$6te$1@mulga.cs.mu.OZ.AU>#1/1
X-Deja-AN: 490725229
Approved: Valentin Bonnard <bonnard@clipper.ens.fr>
References: <37659D89.565ACF7D@technologist.com> <7k5ncv$n8u$1@nnrp1.deja.com> <376690B6.6231FB13@technologist.com> <376761DB.603FE6F1@physik.tu-muenchen.de> <37681965.87E5D3D0@technologist.com>
X-Original-Date: 17 Jun 1999 12:20:57 GMT
Organization: Computer Science, The University of Melbourne
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUAN2klVqwEuYhIxRhxAQEsIQH/eqiis7GEZQaCGJmGywqWWYfIKpw6VoNN HxShrJADfQlu+ZOZZ+31u130BVdfSgv/4BmRqACrjbR+yc8POwIXiQ== =0qg6
Newsgroups: comp.std.c++

David R Tribble <dtribble@technologist.com> writes:

>Christopher Eltschka wrote:
>> 
>> [...] 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".

It's not necessary to create trampolines "on the fly".  You can
allocate a stack of trampolines statically (at link time, for example),
and allocate trampolines from this stack as needed.  They can be
deallocated when the containing scope is exited.

You don't need to be able to write to code space, because
you can keep the data parts and the code parts of the trampoline
stack in separate parallel arrays.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.
---
[ 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              ]



