🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5274

Re: Recursion (was: The D Programming Language)

#5274
From: Jacob Gore
Date: Sun, 13 Mar 1988 21:05
34 lines
1834 bytes
/ comp.lang.misc / nevin1@ihlpf.ATT.COM (00704a-Liber) / Mar 11, 1988 /

I agree with Nevin's sentiment about inlining routines:  There are situations
in which to want them, and situations in which to avoid them.

But I think there are some misconceptions in both his posting and in the one
he was replying to:

>.[...] if the
>.called routine may make additional calls, it may be necessary to use a 
>.separate return stack, and this may require each such subroutine to maintain
>.its own return stack.

Why would you need separate stacks for each routine?

>[...] NOT ALL FUNCTIONS ARE INLINEABLE!!  Any function
>that can be called recursively (see my above definition of recursive) an
>unknown (at compile/link time) number of times cannot be inlined!!

It can, if it can be converted to iteration, and a stack is maintained for its
scope.  (There is no reason to expect local objects and return addresses to be
on the same stack, is there?)

Another reason you may not want to use inline functions is that they make code
maintenance harder.  If a function is used inline, and I change its guts
(without changing its interface or semantics), I have to recompile all code
that invokes it.  If I leave it as a separate routine, I can simply re-link it
(or even just reload it, depending on whether or not my environment supports
run-time linking).

Jacob

Jacob Gore				Gore@EECS.NWU.Edu
Northwestern Univ., EECS Dept.		{oddjob,gargoyle,ihnp4}!nucsrl!gore
Technical Details
Message-ID: <4000013@eecs.nwu.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!oddjob!nucsrl!gore
References: <3980@ihlpf.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!oddjob!nucsrl!gore
From: gore@eecs.nwu.edu (Jacob Gore)
Newsgroups: comp.lang.misc
Subject: Re: Recursion (was: The D Programming Language)
Message-ID: <4000013@eecs.nwu.edu>
Date: 13 Mar 88 21:05:46 GMT
References: <3980@ihlpf.ATT.COM>
Organization: Northwestern U, Evanston IL, USA
Lines: 34