Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mmintl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!cmcl2!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c Subject: Re: more about programming style Message-ID: <487@mmintl.UUCP> Date: Mon, 15-Jul-85 14:26:21 EDT Article-I.D.: mmintl.487 Posted: Mon Jul 15 14:26:21 1985 Date-Received: Sat, 20-Jul-85 01:57:17 EDT References: <11457@brl-tgr.ARPA> <68@ucbcad.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 29 Summary: Examples are not the same In article <68@ucbcad.UUCP> faustus@ucbcad.UUCP (Wayne A. Christopher) writes: > if you write > > while (p->duck) > p++; > >instead of > > while (p++->duck) > ; > This will probably not be the only posting pointing out that your examples are different. The first will leave p pointing to the first structure for which duck is zero; the second leaves it pointing one past it. The ease with which this kind of mistake can be made in c by an experienced c programmer, and the difficulty of finding such mistakes, is to me the main weakness of c. To me, serious programming does not mean playing with a piece of code to get every last instruction cycle out of it, (nor writing as many lines of code as possible, the opposite fallacy), but getting as much function implemented as quickly as possible. (Note that code that runs too slowly is not functional. Usually this happens when excess I/O is being done. There are relatively few places where saving an instuction or two is worthwhile - and those should be extracted in small subroutines (e.g., strcpy) which can be written in assembler if necessary.)