Xref: utzoo comp.lang.c:22244 comp.unix.questions:16539 comp.unix.wizards:18325 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!sun-barr!newstop!sun!amdahl!kucharsk From: kucharsk@uts.amdahl.com (William Kucharski) Newsgroups: comp.lang.c,comp.unix.questions,comp.unix.wizards Subject: Re: Bcopy, bzero and bcmp on a not-Berkeley machine Keywords: bcopy bzero bcmp berkely system_v Message-ID: <13p902Mz5aZY01@amdahl.uts.amdahl.com> Date: 25 Sep 89 23:38:03 GMT References: <1155@radig.UUCP> Reply-To: kucharsk@amdahl.uts.amdahl.com (William Kucharski) Organization: Amdahl Coup, UTS Products Hen House Lines: 33 In article <1155@radig.UUCP> peter@radig.UUCP (Peter Radig) writes: >Is is possible to replace calls to `bcopy', `bzero' and `bcmp' by >the following macros: > > #ifdef USG > #define bcmp(s1,s2,cnt) memcpy(s1,s2,cnt) This should be memcmp(s1,s2,cnt) > #define bzero(addr,cnt) memset(addr,'\0',cnt) This should be fine. > #define bcopy(fr,to,cnt) memcpy(to,fr,cnt) Here's where you may have problems, depending upon the use in your program. The big difference between bcopy and memcpy is that bcopy is defined to handle copies of overlapping ranges of memory correctly while memcpy's behavior in the same situtation is implementation and/or architecture dependent. Hope this helps... -- =============================================================================== | ARPA: kucharsk@uts.amdahl.com | William Kucharski | | UUCP: ...!{ames,apple,sun,uunet}!amdahl!kucharsk | Amdahl Corporation | =============================================================================== | Saying: "It's a window system named 'X,' NOT a system named 'X Windows'" | =============================================================================== | Disclaimer: "The opinions expressed above may not agree with mine at any | | other moment in time, so they certainly can't be those of my | | employer." | ===============================================================================