Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: SysV bcopy? Keywords: bcopy memcpy SysV BSD Message-ID: <16451@mimsy.UUCP> Date: 20 Mar 89 06:02:25 GMT References: <114@sherpa.UUCP> <604@pmafire.UUCP> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 >In article <114@sherpa.UUCP> rac@sherpa.UUCP (Roger A. Cornelius) asks: >>Is there a routine in the system V library analogous to BSD's bcopy(). In article <604@pmafire.UUCP> dave@pmafire.UUCP (Dave Remien) replies (and in other articles, others write): >Being fundamentally in favor of making life easier, I have a file that I >include in all BSD source at the top, which contains: > >#define bcopy(s,d,n) memcpy((d),(s),(n)) Beware: bcopy() is more like memmove() than memcpy(). This is not well documented, and is sometimes even false (e.g., for 4.2BSD with n > 65535 and s < d < s + n; for 4.2BSD-derived systems such as SunOS, I cannot even guess), but using memmove is safer. To put it another way: #define bcopy(s, d, n) memmove(d, s, n) will always work, while #define memmove(d, s, n) bcopy(s, d, n) may not. (The latter does work in 4.3BSD and 4.3BSD-tahoe.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris