Bcopy, bzero and bcmp on a not-Berkeley machine

William Kucharski kucharsk at uts.amdahl.com
Tue Sep 26 09:38:03 AEST 1989


In article <1155 at radig.UUCP> peter at 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 at 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."						      |
===============================================================================



More information about the Comp.unix.wizards mailing list