Path: utzoo!attcan!uunet!lll-winken!lll-ncis!helios.ee.lbl.gov!pasteur!ames!oliveb!olivej!rap From: rap@olivej.olivetti.com (Robert A. Pease) Newsgroups: comp.sys.ibm.pc Subject: Re: Another msc 5.1 bug Message-ID: <35615@oliveb.olivetti.com> Date: 6 Jan 89 03:59:17 GMT References: <139@smsdpg.uu.net> Sender: news@oliveb.olivetti.com Reply-To: rap@olivej.UUCP (Robert A. Pease) Organization: Olivetti ATC; Cupertino, Ca Lines: 27 In article <139@smsdpg.uu.net> seg@smsdpg.UUCP (Scott Garfinkle) writes: |I just ran across a neat new (?) bug in MSC5.1: |#line 1 "foo.c" |fun() { | extern int * const a; | int * const b = a; | | b[0] = 1; |} | |produces "foo.c(5) : error C2166: lval specifies 'const' object" | |In other words, you can't use a const pointer to a non-const chunk of memory. Hold it! This is not a const pointer, its a pointer [to/of] a const identifier. I suspect that if you change the declaration to, int const *b = a; or const int *b = a; that it would work correctly. (My bet is on the second alternative.) Remember that when trying to figure what this thing is in C, you must read it from the right to the left. Robert A. Pease {hplabs|fortune|microsoft|amdahal|piramid|tolerant|sun|aimes}!oliveb!rap