functions within functions

Donald Lindsay lindsay at gandalf.cs.cmu.edu
Sun Jan 27 10:41:10 AEST 1991


In article <1991Jan22.081057.8567 at ithaca.uucp> 
	garry at ithaca.uucp (Garry Wiegand) writes:
>When the C standards committee was meeting, did they discuss allowing 
>the declaration of functions within functions?
>The name-space advantages should be obvious,...

Some of us have used languages that allowed this, and didn't like it.

Personal opinion: the outer functions get unreadable.

Software engineering opinion: the inner ones get undocumented or even
unexpected side effects, because they modify global variables.
(Global to them, that is.) 

Compiler writer's opinion: the calling convention now has to support
uplevel addressing. This is typically done at a cost of at least one
extra instruction per call. This distributed overhead is paid by all
calls - not just the ones that plan to uplevel-address - unless your
compiler does interprocedural optimization.
-- 
Don		D.C.Lindsay .. temporarily at Carnegie Mellon Robotics



More information about the Comp.std.c mailing list