functions within functions

John F Haugh II jfh at rpp386.cactus.org
Tue Feb 12 01:13:18 AEST 1991


In article <1991Feb11.090514.5736 at ithaca.uucp> garry at ithaca.uucp (Garry Wiegand) writes:
>I have seen the innards of compilers like the old 'pcc': they are
>really badly written, with lots of mode variables declared globally.
>*Not* structured/modular/defensive. In a well-written compiler you
>would probably have to make an extra check to *disallow* functions-
>in-functions. 

I would say a well written compiler would still have to add something
to permit function definitions within a function.

There are definitions which are not permitted inside of a function,
such as definitions containing initialized aggregates, as well as
ones which are forbade outside of functions, such as automatic
variables (does anyone use "auto" anymore???)

If the parser does not faithfully implement the syntax of the language,
I'd say something is seriously wrong, even if the code is "structured",
or whatever.  The syntax elements <function-definition> and
<automatic-variable-definition> had best not be lumped into the single
syntax element <some-kind-of-definition>.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"I've never written a device driver, but I have written a device driver manual"
                -- Robert Hartman, IDE Corp.



More information about the Comp.std.c mailing list