Re: static declarations & accessibility

rsalz@bbn.com (Rich Salz)
15 Dec 87 19:21:15 GMT

          From comp.compilers

Related articles
static declarations & accessibility ihnp4!wucs1!wuibc2!brown (1987-12-13)
Re: static declarations & accessibility rsalz@bbn.com (1987-12-15)
Re: static declarations & accessibility wucs1!wuibc2!brown@uunet.UU.NET (1987-12-20)
| List of all articles for this month |

From: rsalz@bbn.com (Rich Salz)
Newsgroups: comp.compilers
Summary: That's what CONST is for
Date: 15 Dec 87 19:21:15 GMT
References: <785@ima.ISC.COM>
Organization: BBN Laboratories, Cambridge MA

In comp.compilers (<785@ima.ISC.COM>), ihnp4!wucs1!wuibc2!brown (Michael Brown) writes:
>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.


Not a good argument: it's overruled by the semantics of pointers, and
you've just outlawed the following construct:
doit()
{
static int done;


if (!done) {
done = 1;
...
}
...
}


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.
--
For comp.sources.unix stuff, mail to sources@uunet.uu.net.
[Similar comments received from several other readers. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.