From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,23963231b5359f74 X-Google-Attributes: gid10a146,public X-Google-Thread: 103376,23963231b5359f74 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-17 05:41:51 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!news-server.bigpond.net.au!not-for-mail From: "HarryO" Subject: Re: Long names are doom ? Newsgroups: comp.lang.ada,comp.lang.java.programmer Message-ID: <20010617.224149.76065818.15975@zipworld.com.au> References: <3B0DBD4A.82943473@my-deja.net> <3B0DD011.88FCD00E@acm.org> <83WP6.3874$yc6.728572@news.xtra.co.nz> <3B1411D0.3AAF42E7@ftw.rsc.raytheon.com> <9f2nks$ibd$0@dosa.alt.net> <3B177EF7.2A2470F4@facilnet.es> <9f8b7b$h0e$1@nh.pace.co.uk> <9f8r0i$lu3$1@nh.pace.co.uk> <3b1ee2d5$2$fuzhry$mr2ice@va.news.verio.net> User-Agent: Pan/0.9.7 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Sun, 17 Jun 2001 12:41:50 GMT NNTP-Posting-Host: 144.132.249.179 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 992781710 144.132.249.179 (Sun, 17 Jun 2001 22:41:50 EST) NNTP-Posting-Date: Sun, 17 Jun 2001 22:41:50 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:8823 comp.lang.java.programmer:76974 Date: 2001-06-17T12:41:50+00:00 List-Id: In article <3b1ee2d5$2$fuzhry$mr2ice@va.news.verio.net>, "Unknown" wrote: >>if (*i++ < ++j) *k++; > > I hate, loathe and despise C, yet I still find that code to be perfectly > understandable, with the exception of the variable names.. Of course, it looks reasonable, but (and I realise it was probably not a real piece of code) as it is, the code probably doesn't do what is intended and certainly doesn't do what one might guess it does. The reason is that the "++" binds more tightly than the "*", so all this code actually does is increment k some number of times, hence the '*' is totally superflous. Persumably, what was intended was "(*k)++". Just another example as to why "terse" can lead to "buggy", I guess :-). While I wouldn't (generally) make that mistake, because I know the precedence, I'd probably be less terse and use "*k += 1" in this case or maybe even "(*k) += 1" to make it obvious to the next person that this code is fiddly. Who knows, I might even go overboard and put in a comment to explain it :-).