Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!ingr!crossgl From: crossgl@ingr.com (Gordon Cross) Newsgroups: comp.lang.c Subject: Re: comma operator: keep away? Message-ID: <5053@ingr.com> Date: 20 Apr 89 13:15:38 GMT References: <10007@smoke.BRL.MIL> <498@lakart.UUCP> <10057@smoke.BRL.MIL> <628@gonzo.UUCP> <28831@ucbvax.BERKELEY.EDU> <828@twwells.uucp> Reply-To: crossgl@ingr.UUCP (Gordon Cross) Organization: Intergraph Corp. Huntsville, Al Lines: 33 In article <828@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: > >The thing that is wrong with the latter has little to do with >mystification. What is wrong is that, for rapid and accurate >understanding of code, one should avoid appearing to do more than one >thing at a time. > >In other words, the physical layout of the code should make each thing >being done appear distinct from all the other things being done. I'd like to make one small observation about Mr. Wells' above comment. In certain cases where execution speed is of primary importance and you don't have the time or energy to code in assembler (God forbid!) the vast majority of compilers (that I've seen anyway) tend to generate better code for a single complex expression that accomplishes multiple (related) tasks than for the equivalent multiple simple expressions. For example an "insert into doubly linked list" operation on my compiler: This one used 4 instructions - (new->next = next)->prev = (new->prev = prev)->next = new; This one used 7 instructions - new->next = next; new->prev = prev; next->prev = new; prev->next = new; -- Gordon Cross UUCP: uunet!ingr!crossgl "all opinions are 111 Westminister Way INTERNET: crossgl@ingr.com mine and not those Madison, AL 35758 MA BELL: (205) 772-7842 of my employer."