Article View: comp.sys.amiga.tech
Article #228Re: Can you nest subroutines in C?
From: Mike (I'll think of something ye...
Date: Wed, 28 Jun 1989 09:40
Date: Wed, 28 Jun 1989 09:40
24 lines
1650 bytes
1650 bytes
In article <4470@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes: <The advantage to doing this is that it avoids either the declaration of <w,h, and d (width,height and depth respectively) as globals or passing them <as parameters to InitScreenBuffer() in which case they would appear three <times on the stack (18 bytes vs 6). Since nobody else has mentioned it (yet), I will. You can fake this kind of thing by putting the all the "nested" routines in one file, and making the "pseudo-globals" statics in that file. Of course, you can only deal with one level of nesting this way, and you have to play games with include files and extern to make the true globals work out, but it can be done. As for the whole topic, I have to agree with a quote attributed to one of the designers of Ada: "If you've got data abstraction, nesting is for the birds." <mike -- When all our dreams lay deformed and dead Mike Meyer We'll be two radioactive dancers mwm@berkeley.edu Spinning in different directions ucbvax!mwm And my love for you will be reduced to powder mwm@ucbjade.BITNET
Technical Details
Message-ID:
<25840@agate.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwmReferences:
<4470@crash.cts.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwm From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: Can you nest subroutines in C? Message-ID: <25840@agate.BERKELEY.EDU> Date: 28 Jun 89 09:40:43 GMT References: <4470@crash.cts.com> Sender: usenet@agate.BERKELEY.EDU Reply-To: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Organization: Missionaria Phonibalonica Lines: 24