Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!mips!prls!pyramid!thirdi!peter From: peter@thirdi.UUCP (Peter Rowell) Newsgroups: comp.unix.questions Subject: memcpy != bcopy (Was Re: bcopy() bzero()) Message-ID: <497@thirdi.UUCP> Date: 12 Feb 90 00:43:15 GMT References: <11387@attctc.Dallas.TX.US> <4601@orion.cf.uci.edu> Reply-To: peter@thirdi.UUCP (Peter Rowell) Distribution: usa Organization: Third Eye Software, Menlo Park, CA Lines: 19 echarne@orion.oac.uci.edu (Eli B. Charne) writes: >larryd1@attctc.Dallas.TX.US (Larry Clark) writes: >> I'm porting sources from the bsd world into a Sys V environment >> and need an explanation of bcopy() and bzero(). >> .... > ... > bcopy() Copies length bytes from the "string" b1, and copies them into > string b2. I was under the impression this was exactly what memcpy() > does, but perhaps the order of arguments is changed. WARNING! memcpy is NOT the same as bcopy!!!! This is the source of an *amazing* array of hard-to-find bugs! bcopy correctly handles overlapping memory moves; memcpy does not. If you code does not expect/require (either deliberately or accidentally) that overlapping moves be done correctly, then it is "safe" to claim the two are equivalent. PS. the first two arguments to bcopy are reversed in memcpy.