Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 May 1996 19:31:28 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        current@freebsd.org, scrappy@ki.net
Subject:   Re: memset/memcopy vs bzero/bcopy
Message-ID:  <199605280931.TAA10416@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Subject: memset/memcopy vs bzero/bcopy

>	which one is preferred?  and does it matter?

New application code should use memset.

kernel code must use bzero.  memset isn't available in the kernel.

New application code should use memcpy for non-overlapping copies and
memmove for possibly-overlapping.  memcopy doesn't exist.

kernel code should use bcopy except for small, aligned copies, especially
for ones of a known size.  memcpy is only used in the kernel to give gcc
a chance to inline it.  The inline code is slower for misaligned copies
and may be slower for large copies.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605280931.TAA10416>