🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3369

Re: scope of functions

#3369
From: halasz
Date: Fri, 18 Aug 1995 16:38
27 lines
1254 bytes
In article <DDG3wE.Mvp@eskimo.com>, mag@eskimo.com (mag) writes
> No functions cannot be nested under C. Every function is at the same level.
> Actually there is no need to do so. Under C++, however, you can get "kind
> of nested functions" using classes and member functions.

In theorie, ay, there is no need.  But there is much that is neaterlie
written with nested function.  There is one problem of C that can be
heald with inner function, re:entrant use of "longjmp" from within a
signal-handler:

	f(...)
	{	jmp_buf v;

		void handler(int s)
		{	...
			longjmp(v, s);
		}
		...
			signal(SIGINT, handler);
			...
/* can even be in calld function, if "v" s address is passd to it */
			if (setjmp(v))
		...
	}

This problem can also be solvd by letting "signal" take a pointer that it
passes to the handler.  Backward (in)compatibilitie is a big problem here.
Technical Details
Message-ID: <412fmv$efu@caip.rutgers.edu>
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail
References: <40t0cg$t8q@charles.cdec.polymtl.ca> <DDG3wE.Mvp@eskimo.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail
From: halasz@caip.rutgers.edu
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: scope of functions
Date: 18 Aug 1995 12:38:55 -0400
Organization: Rutgers University
Message-ID: <412fmv$efu@caip.rutgers.edu>
References: <40t0cg$t8q@charles.cdec.polymtl.ca> <DDG3wE.Mvp@eskimo.com>
NNTP-Posting-Host: caip.rutgers.edu