functions within functions
Garry Wiegand
garry at ithaca.uucp
Mon Feb 11 20:05:14 AEST 1991
In article <1991Feb8.232835.19022 at watmath.waterloo.edu> datangua at watmath.waterloo.edu (David Tanguay) writes:
>One of the "problems" with adding nested functions to C is the addition
>of a display to access autos in outer scopes. The whole issue could be
>avoided by not having autos imported into functions.
>...
> b = d+1; /* is okay */
> c = 0; /* error: c is not in scope */
Exactly! Doesn't hurt, gives people like me another level of function
name-scoping, and if at some later time the community wants to add
access to outer autos and parameters ("closure", as someone
explained to me), that would be upward-compatible.
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 wonder how many of the representatives on the standards committee
have "well-written compilers"...
>Additional idea:
> an auto function is not visible to inner functions, static function is.
Hmmmm...
Garry Wiegand --- Ithaca Software, Alameda, California
...!uunet!ithaca!garry, garry%ithaca.uucp at uunet.uu.net
More information about the Comp.std.c
mailing list