[mercury-users] Event handling in mercury

Richard A. O'Keefe ok at atlas.otago.ac.nz
Tue Jul 24 12:05:10 AEST 2001


Peter Schachte wrote:

	Really, "static variable" is an oxymoron.  I can't imagine what possessed
	K&R to use that word (for two completely different things:  "having the
	lifetime of the whole program execution" and "not visible outside this
	file.")
	
I can tell you where 'static' and 'auto' come from, and I can guess why
K&R overloaded two meanings on 'static'.

A little bit of history here.  UNIX is called "UNIX" as a punning reference
to "Multics".  K&R knew about Multics.  Multics was (the last Multics machine
was shut down just a few years ago) programmed in PL/I.  And in PL/I
    DECLARE X .... AUTOMATIC;
	means allocate it on the stack frame
    DECLARE X ... STATIC;
	means give it static allocation.
    DECLARE X ... CONTROLLED;
	means a form of dynamic allocation.
PL/I variables declared static were only visible in the surrounding
scope, just like variables declared automatic.  In the same way, C
variables declared 'static' are only visible in the surrounding scope,
just like C variables declared 'auto', except you can't use 'auto' at
top level in C.

The thing that's irregular in C is not 'static' being local, but
variables declared _without_ any scope control keyword being local
inside a function but global outside.

Now, can you guess what language the 'volatile' keyword comes from?
(Hint: its name starts with the letter beween O and Q.)
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list