c - bzero() & bcopy() versus memset() & memcpy() -
is there reason use non-standard bzero()
, bcopy()
instead of memset()
, memcpy()
in linux environment? i've heard many they're better linux compilers, haven't seen advantages on standard functions.
are more optimized standard ones, or have behavioral particularity they're preferred?
the bzero
, bcopy
functions aren't standard (iso) c, posix thing (in terms of official standards - in actuality pre-dated both iso , posix).
and note word "were" - deprecated in posix.1-2001 , removed in posix.1-2008 in deference memset
, memcpy
, memmove
, you're better off using standard c functions.
if have lot of code uses them , don't want have go , change (though should @ point), can use following quick substitutions:
// void bzero(void *s, size_t n); #define bzero(s, n) memset((s), 0, (n)) // void bcopy(const void *s1, void *s2, size_t n); #define bcopy(s1, s2, n) memmove((s2), (s1), (n))
Comments
Post a Comment