Path: utzoo!mnetor!uunet!husc6!necntc!ima!johnl
From: johnl@ima.UUCP
Newsgroups: comp.compilers
Subject: static declarations & accessibility
Message-ID: <785@ima.ISC.COM>
Date: 13 Dec 87 21:18:15 GMT
Sender: johnl@ima.ISC.COM
Reply-To: ihnp4!wucs1!wuibc2!brown (Michael Brown)
Lines: 35
Approved: compilers@ima.UUCP

Since things are slow how about this question?

Do any compilers attempt to protect static data ( static in the sense
of hiding the data in a function or module ) from access outside of
the scope of the declaration?

Is there a system which can change the access modes of the static data
to cause the data to be inaccessible by routines outside of the scope of
the data's declaration?

Has anyone ever tried something like this as a run time consistency check?  
Offhand, the efficiency of this sort of scheme in a virtual memory
environment would seem to depend on the overhead in manipulating the
process page table entries on function entry/exit.

All C language implementations I've use have allowed the address of
the static data to be obtained if one wanted to do weird things...
I'd argue that this should be prohibited by the semantics of the
static declaration.

	Regards,
	Mike Brown		Institute for Biomedical Computing
				Washington Univ., St. Louis, MO
				(314) 362-2135

UUCP:	{..., uunet}!wucs1!brown
ARPA:	brown@noao.arizona.edu
[I'd argue that a large fraction of the static data that I declare is
prototype structures, e.g. list heads, that I pass all over the place.
But that's a separate issue from the first one you bring up.  -John]
--
Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.ARPA
Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request