Xref: utzoo comp.unix.questions:19990 comp.lang.c:26024 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!samsung!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions,comp.lang.c Subject: Re: memcpy != bcopy (Was Re: bcopy() bzero()) Message-ID: <22599@mimsy.umd.edu> Date: 17 Feb 90 16:12:26 GMT References: <11387@attctc.Dallas.TX.US> <4601@orion.cf.uci.edu> <497@thirdi.UUCP> Followup-To: comp.lang.c Distribution: usa Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 16 In article <497@thirdi.UUCP> peter@thirdi.UUCP (Peter Rowell) writes: >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. Beware: some versions of bcopy() do, some do not. (4.2BSD VAX bcopy() handled overlap when copying 65535 bytes or less or when forward block moves were correct. 4.3BSD VAX bcopy() always handles overlap.) For absolute safety, use memmove() (a feature of ANSI X3.159 C). Followups directed to comp.lang.c (put them somewhere else if not talking about the C aspects of overlapping moves, please). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris