Article View: comp.sys.amiga.tech
Article #280Re: Can you nest subroutines in C?
From: John
Date: Fri, 30 Jun 1989 13:59
Date: Fri, 30 Jun 1989 13:59
19 lines
1462 bytes
1462 bytes
In article <4501@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes: >.. I do not understand why C does not support Nested routines. .. I think it's because you need to maintain a display (or something like that) to resolve references to variables in enclosing procedures. C has a lean and mean close to the machine philosophy, which this would run counter to. It also causes all kinds of horrible problems if you want to have pointers to functions - if you save a pointer to a nested function in an array, then call it much later on from another part of your program, what should those external variable references resolve to? Should a pointer to function in fact be a structure containing the entire context of the function at the time the pointer was created? All very un C-like. There are two issues here - nested funtions and allowing references to parameters in enclosing functions. BCPL (:-) has nested functions, but not references to enclosing scopes (a nicer compromise, IMHO) John Cupitt
Technical Details
Message-ID:
<1701@harrier.ukc.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!mcvax!ukc!harrier.ukc.ac.uk!jrcReferences:
<4501@crash.cts.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!cs.utexas.edu!uunet!mcvax!ukc!harrier.ukc.ac.uk!jrc From: jrc@ukc.ac.uk (John) Newsgroups: comp.sys.amiga.tech Subject: Re: Can you nest subroutines in C? Message-ID: <1701@harrier.ukc.ac.uk> Date: 30 Jun 89 13:59:48 GMT References: <4501@crash.cts.com> Reply-To: jrc@ukc.ac.uk (John) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 19