🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #246

Re: Can you nest subroutines in C?

#246
From: Mike (I'll think of something ye...
Date: Thu, 29 Jun 1989 06:08
39 lines
2228 bytes
In article <4495@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes:
<        So far I have found nothing I could do in C that I could not do in
<M2.  To me this is the test of a Language.

You're not looking very hard. Please translate the following C
construct into M2:

	short main[] = {1, 2, 3} ;

On hardware that supports it, this sets up three words, puts the
values 1, 2 and 3 into them, and arranges to branch to that location
under the right conditions. Likewise, can you write M2 code that
_will_ generate an address exception? Both of these features were used
in the Unix kernel at one point in the past. 

Of course, if you don't need to do these kinds of things, then you
don't care about them. So C may not be the language of choice for the
problem at hand. And that's my test of a Language - how do the idioms
of the problem I'm solving map to it.

Finally, from elsewhere:

>> In fact, if you declare a function (or a variable external to a function)
>> to be static, it will be local to the source file but global to all functions
>> within that file. 

Not quite. C (like many other languages) reqiures forward
declarations.  Functions and variables are only visible to code that
occurs after their decleration in the file. And an external variable
declared in a function only has function scope in ANSI C. In pre-ANSI
C, the scope wasn't explicitly defined, and PCC based compilers gave
it file scope.

	<mike
--
Teddies good friend has his two o'clock feast		Mike Meyer
And he's making Teddies ex girl friend come		mwm@berkeley.edu
They mistook Teddies good trust				ucbvax!mwm
Just for proof that Teddy was dumb.			mwm@ucbjade.BITNET
Technical Details
Message-ID: <25874@agate.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwm
References: <4495@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwm
From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Can you nest subroutines in C?
Message-ID: <25874@agate.BERKELEY.EDU>
Date: 29 Jun 89 06:08:03 GMT
References: <4495@crash.cts.com>
Sender: usenet@agate.BERKELEY.EDU
Reply-To: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer)
Organization: Missionaria Phonibalonica
Lines: 39