Newsgroups: comp.std.c Path: utzoo!utgpu!watserv1!watmath!datangua From: datangua@watmath.waterloo.edu (David Tanguay) Subject: Re: functions within functions Organization: University of Waterloo Date: Fri, 8 Feb 1991 23:28:35 GMT Message-ID: <1991Feb8.232835.19022@watmath.waterloo.edu> References: <1991Jan27.092018.2965@kithrup.COM> <741@caslon.cs.arizona.edu> Lines: 27 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. E.g.: int f( int a ) { static int b; auto int c; int g( int d ) { b = d+1; /* is okay */ c = 0; /* error: c is not in scope */ return d * b; } c = g( a + b ); return 3 * c + 2; } /* g is not visible here */ This results in scoping rules similar to Port (a cousin of C -- B->Zed->Port, I believe). Additional idea: an auto function is not visible to inner functions, static function is -- David Tanguay Software Development Group, University of Waterloo