Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!HTIKHT5.BITNET!S170MIKO From: S170MIKO@HTIKHT5.BITNET Newsgroups: mod.computers.vax Subject: Re: VAX C bug Message-ID: <8611011438.AA23299@ucbvax.berkeley.edu> Date: Fri, 31-Oct-86 12:29:00 EST Article-I.D.: ucbvax.8611011438.AA23299 Posted: Fri Oct 31 12:29:00 1986 Date-Received: Mon, 3-Nov-86 20:56:31 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 47 Approved: info-vax@sri-kl.arpa Gary McDonald writes: > The following program WON'T compile as is: > > ================== > /* from page 1-20 PROGRAMMING IN VAX C */ > #include stdio > int *pointer; > int x=10, y=0; > main() > { > pointer=&x; > y=*pointer; > printf("values are %d %d %d\n",pointer,x,y); > } > =================== > but will with these changes: > =================== > pointer= &x; > y= *pointer; > =================== > > Is this a *known* bug?? Well, you're wrong both ways: this is *not exactly* the way the example in the manual is written, and it is not a bug but a *feature*. The problem is that this is one of the few cases where spacing is significant, and it is meant to be. This is because =& and =* are actually alternative ways to write the operators &= and *= , and with a space in between they mean just what you think they mean. This is mentioned (briefly) in the manual on pages 4-19 & 4-20. The examples in the manual always include lots of (insignificant) spaces just to improve readability, so it's not obvious that these two spaces immediately after = are really necessary to avoid ambiguity, but they are there in the example. By the way, if you're working through the examples in chapter 1 you'll probably have found the *real* error in example 1-6: the statement _tolower(ch) should of course be ch = _tolower(ch). Michiel -- Michiel Koren EARN/Bitnet: s170miko@htikht5.BITNET Tilburg University SURFnet: kubvx1::s170miko Netherlands