🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2384

Re: functions within functions

#2384
From: David Tanguay
Date: Fri, 08 Feb 1991 23:28
27 lines
1104 bytes
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
Technical Details
Message-ID: <1991Feb8.232835.19022@watmath.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!datangua
References: <1991Jan27.092018.2965@kithrup.COM> <741@caslon.cs.arizona.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!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