Path: utzoo!mnetor!uunet!husc6!necntc!ima!johnl From: wucs1!wuibc2!brown@uunet.UU.NET (Michael Brown) Newsgroups: comp.compilers Subject: Re: static declarations & accessibility Message-ID: <811@ima.ISC.COM> Date: 20 Dec 87 20:54:47 GMT References: <785@ima.ISC.COM> Sender: johnl@ima.ISC.COM Reply-To: wucs1!wuibc2!brown@uunet.UU.NET (Michael Brown) Organization: Washington University Lines: 37 Approved: compilers@ima.UUCP Return-Path: In-Reply-To: <792@ima.ISC.COM> Cc: In reply to my earlier posting, <792@ima.ISC.COM> Rich Salz states: > Not a good argument: it's overruled by the semantics of pointers, and . . . > Anyhow, the ANSI X3J11 C standardization committee invented (okay, stole > from C++) the "const" keyword for just that sort of thing. It's similar > to the VMS C "readonly" storage-class. Check out a copy of the draft > for more info. > [Similar comments received from several other readers. -John] I wasn't clear enough. I don't interpret the modifier "static" as meaning read only but that the declaration is *hidden* from references outside of the scope of the declaration. The motivation for the original question was that if a declaration is meant to be hidden then why not allow optional runtime protection to force an error if the hidden declaration is accidentally/un-intentionally referenced from outside of the context of the declaration. I recognize that the static modifier has other uses in addition to information hiding. Regards, Mike Brown Institute for Biomedical Computing Washington Univ., St. Louis, MO (314) 362-2135 [Not a bad idea, but isn't it really just a special case of pointer checking, e.g. ensuring that array subscripts point into an array, that a pointer to foo is really pointing to a foo, and so forth. Hard to do unless you're interpreting everything, though. -John] -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU 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