Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!munnari!moncskermit!basser!anucsd!csadfa!davidp From: davidp@csadfa.oz (David Purdue) Newsgroups: comp.sources.bugs Subject: Re: Problems with Centipede Message-ID: <1064@csadfa.oz> Date: Tue, 14-Jul-87 20:11:03 EDT Article-I.D.: csadfa.1064 Posted: Tue Jul 14 20:11:03 1987 Date-Received: Fri, 17-Jul-87 04:41:46 EDT References: <758@soliloquy.rutgers.edu> Organization: Dept. of Computer Science, University College, UNSW, ADFA, Canberra, Australia Lines: 37 in article <758@soliloquy.rutgers.edu>, dpz@soliloquy.rutgers.edu (David P. Zimmerman) says: ] ]> From: eap@bucsb.bu.edu.UUCP (Eric Pearce) ] ]> Anybody else have this problem with Nathan Glasser's "Centipede" ? ] ]> "save.c", line 133: Cannot take the address of this object ] ] 109c109 ] < register char ch; ] --- ]> register char *ch; ] 133c133 ] < read(fd,&ch,1); ] --- ]> read(fd,ch,1); ] 135c135 ] < ch != MAGICNUM) ] --- ]> *ch != MAGICNUM) THIS PATCH IS NOT GOOD PROGRAMMING! It is not even guaranteed to work (and in most cases I suspect it won't). You see, by changing ch to *ch, you are only allocating storage for a POINTER to the char, not for the char (note the absence of a malloc()). The better fix is to drop the 'register' from 'register char ch' and put up with the (slight) (noticable??) degredation in performance. DavidP ---- Mr. David Purdue Phone ISD: +61 62 68 8165 Dept. Computer Science Telex: ADFADM AA62030 University College ACSNET/CSNET: davidp@csadfa.oz Aust. Defence Force Academy UUCP: ...!seismo!munnari!csadfa.oz!davidp Canberra. ACT. 2600. ARPA: davidp%csadfa.oz@SEISMO.CSS.GOV AUSTRALIA JANET: davidp@oz.csadfa "Perversity Rules, C.Q.!"