*BSD News Article 39151


Return to BSD News archive

Xref: sserve comp.unix.bsd:15499 comp.lang.c:87577 comp.unix.sys5.r3:2311
Newsgroups: comp.unix.bsd,comp.lang.c,comp.unix.sys5.r3
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!caen!newsxfer.itd.umich.edu!gatech!swrinde!pipex!uunet!maple.enet.net!asuvax!chnews!ornews.intel.com!news.jf.intel.com!psinntp!psinntp!garfield!dev17!egriebel
From: egriebel@dev17 (Ed Griebel)
Subject: Re: how to completely get rid of bcopy, bzero, bcmp?
Message-ID: <1994Dec7.211430.3596@bfm.com>
Followup-To: comp.unix.bsd,comp.lang.c,comp.unix.sys5.r3
Sender: news@bfm.com
Organization: BFM
X-Newsreader: TIN [version 1.2 PL2]
References: <3bksus$fg4@spruce.cic.net> <MICHAELV.94Dec2213754@MindBender.HeadCandy.com>
Date: Wed, 7 Dec 1994 21:14:30 GMT
Lines: 38

Michael L. VanLoon (michaelv@MindBender.HeadCandy.com) wrote on 03 Dec 1994 03:37:54 GMT:
: In article <3bksus$fg4@spruce.cic.net> pauls@locust.cic.net (Paul Southworth) writes:

: See memcpy, memset, memcmp.

The problem with memcpy is that it doesn't check for overlapping
regions.  where, as I understand it (coming from a SunOS/BSD 4.3
world), bcopy will handle overlaps correctly. From the memcpy(2)
manpage:
	memcpy(void *s1, const void *s2, size_t n);
	[...]
	If the source and destination areas overlap such that s2 <
	s1<s2 + n, the behavior is undefined.
	[...]
	..if the source and destination areas overlap...use _rmemcpy [I
	think a machine-specific call?]

Also, the source and destination args to b*() are the reverse of mem*().

-ed

[sorry for multiple followup groups...]
: --
: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:    Michael L. VanLoon     michaelv@HeadCandy.com     michaelv@iastate.edu
:   Free your mind and your machine -- NetBSD free un*x for PC/Mac/Amiga/etc.
:      Working NetBSD ports: 386+PC, Mac, Amiga, HP300, Sun3, Sun4c, PC532
:                In progress: DEC pmax (MIPS R2k/3k), VAX, Sun4m
: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

--
---
	"You can't let go and you can't hold on,
	 You can't go back and you can't stand still"
+---------------------------------+--------------------------------------+
! Edward Griebel                  ! Trading Systems Group                !
! e-mail: ed_griebel@bfm.com      ! BlackRock Financial Management       !
+---------------------------------+--------------------------------------+