Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Explanation, please! Message-ID: <660@proxftl.UUCP> Date: 29 Aug 88 07:58:01 GMT References: <638@paris.ICS.UCI.EDU> <634@proxftl.UUCP> <1988Aug28.031926.19222@utzoo.uucp> Reply-To: bill@proxftl.UUCP (T. William Wells) Organization: Proximity Technology, Ft. Lauderdale Lines: 28 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <1988Aug28.031926.19222@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: : In article <634@proxftl.UUCP> bill@proxftl.UUCP (T. William Wells) writes: : >[Duff's Device] : >The false god of efficiency has reared it ugly head. This : >routine would be imagined to be more efficient than the almost : >equivalent: ... : > while (--count >= 0) : > *to++ = *from++; : > : >However, it often (always?) is not... : : On the contrary, it often (usually?) is. This is from experience, not : theory. (Specifically, experience in C News and related code.) Well, I'll bow to experimental evidence. However, that does make me wish that more compilers went to the effort to deal with this kind (the "unoptimized" version) of loop, seeing as how it is so commonly important. : In general, however, in the long run the correct way to implement bulk : data copying is to call "memcpy", which (in the long run) is likely : to be recognized and given special attention by most compilers. Agreed. That is how I would wish it to be done. --- Bill novavax!proxftl!bill