Checksum: 01526 Lines: 23 Path: utzoo!utgpu!utfyzx!sq!msb From: msb@sq.uucp (Mark Brader) Date: Thu, 31-Mar-88 18:33:21 EST Message-ID: <1988Mar31.183321.4740@sq.uucp> Newsgroups: comp.lang.c Subject: Re: strcpy References: <12622@brl-adm.ARPA> <18516@think.UUCP> <1988Mar27.171450.14256@sq.uucp> Reply-To: msb@sq.UUCP (Mark Brader) Organization: SoftQuad Inc., Toronto Regarding: > > If a machine has a fast instruction that > > does a search for a byte and a fast block move instruction, it would > > probably be best for strcpy to be written > > > > memcpy (dest, src, strpos (src, '\0') + 1); > > > > (assuming that memcpy and strpos are inlined into the appropriate > > instructions ... ) I said, in an article I am now canceling: > The above > algorithm is two-pass, and therefore not robust in the face > of *shared memory*. It has been pointed out to me that a one-pass algorithm is also not robust in a shared-memory situation. The two-pass and one-pass algorithms merely fail in slightly different ways and on slightly different race conditions. Mark Brader, SoftQuad Inc., Toronto, utzoo!sq!msb, msb@sq.com "I'm a little worried about the bug-eater," she said. "We're embedded in bugs, have you noticed?" -- Niven, "The Integral Trees"