🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4125

Re: Nested functions (was: Re: GOTO single exit point)

#4125
From: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 26 Sep 1995 18:21
29 lines
2031 bytes
In article <1995Sep26.112649.1576@ittpub> wil@ittpub.nl (Wil Evers)
writes:

|> In article <KANZE.95Sep25162631@slsvhdt.lts.sel.alcatel.de>  
|> kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:

|> > I believe that trampolines have also been used to overcome this
|> > problem.  When the address of a nested function is taken, a small
|> > initialization program is generated on the fly, to set up the extra
|> > pointers, and then jump to the actual function.  The pointer to
|> > function points to this program.

|> Now you've gotten me curious. I thought the extra information passed to  
|> the called function depended on the nesting level at the point from which  
|> it is called, not on the nesting level at the point where its address is  
|> taken. If that's true, then how can the trampoline set up this  
|> information?

By generating the code on the fly, at the point where the address is
taken.  The generated code is generally not something you could write
in C; it will set up a few extra registers, and then jump to (not
call) the actual function.  The code must be generated at the point
where the address is taken, since the values to be loaded into the
registers are not known before then.
-- 
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils en informatique industrielle --
                              -- Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID: <KANZE.95Sep26192155@slsvhdt.lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!xlink.net!slsv6bt!news
References: <KANZE.95Sep25162631@slsvhdt.lts.sel.alcatel.de> <1995Sep26.112649.1576@ittpub>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!xlink.net!slsv6bt!news
From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Subject: Re: Nested functions (was: Re: GOTO single exit point)
In-Reply-To: wil@ittpub.nl's message of 26 Sep 95 11:26:49 WET
Message-ID: <KANZE.95Sep26192155@slsvhdt.lts.sel.alcatel.de>
Sender: news@lts.sel.alcatel.de
Organization: SEL
References: <KANZE.95Sep25162631@slsvhdt.lts.sel.alcatel.de> <1995Sep26.112649.1576@ittpub>
Date: 26 Sep 1995 18:21:55 GMT