🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #374

Re: Can you nest subroutines in C?

#374
From: Clyde Smith-Stubbs
Date: Wed, 05 Jul 1989 04:10
34 lines
2000 bytes
From article <3982@sugar.hackercorp.com>, by peter@sugar.hackercorp.com (Peter da Silva):
> 
> And nested procedures can be implemented by explicitly passing the frame
> pointer. In fact, you can implement nested procedures efficiently in 'C',
> 

What do you mean by "explicitly passing the frame pointer". The frame
pointer is not accesible to the programmer, indeed some implementations
of C have no frame pointer as such, rather they access locals by offset
from the stack pointer.

> 
>>         As I said before, what bothers me most about this is that I can see no
>> reason why C does not support this feature.
> 
> Because it requires that you implement displays, adding considerably to the
> complexity and overhead of the generated code, for a capability that can be
> implemented by hand.

Implementation of displays in C is not difficult, and properly done need
not add much overhead. Indeed, since it is something that adds no overhead
unless you use it (global functions don't use the display) it fits quite
well with that amorphous "Spirit of C". There are certain recursive
tasks that nested functions can be used to implement in a much more
transparent fashion than doing it by hand (I know, I have had to write
code that effectively maintains a manual display one level deep).

------------------------
Clyde Smith-Stubbs
HI-TECH Software, P.O. Box 103, ALDERLEY, QLD, 4051, AUSTRALIA.

ACSnet:		clyde@hitech.ht.oz
INTERNET:	clyde@hitech.ht.oz.au		PHONE:	+61 7 300 5011
UUCP:		uunet!hitech.ht.oz.au!clyde	FAX:	+61 7 300 5246
Technical Details
Message-ID: <268@hitech.ht.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!murtoa.cs.mu.oz.au!munnari.oz.au!uqcspe!hitech!clyde
References: <3982@sugar.hackercorp.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!murtoa.cs.mu.oz.au!munnari.oz.au!uqcspe!hitech!clyde
From: clyde@hitech.ht.oz (Clyde Smith-Stubbs)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Can you nest subroutines in C?
Message-ID: <268@hitech.ht.oz>
Date: 5 Jul 89 04:10:38 GMT
References: <3982@sugar.hackercorp.com>
Organization: HI-TECH Software, Brisbane, QLD, Australia
Lines: 34