bzero VS memset


The bzero is not in standard (ANSI) C function, it appeared in 4.3BSD (Berkeley UNIX C library). Its prototype existed previously in <string.h> before it was moved to <strings.h> for IEEE Std 1003.1-2001 (``POSIX.1'') compliance.

To use it in ANSI C you have to define it first(Some system do this work). memset, on the other hand, pre-exists and has a known meaning.
This function is deprecated (marked as LEGACY in POSIX.1-2001): use
memset in new programs.

This is a partially obsolete alternative for memset, derived from BSD. Note that it is not as general as memset, because the only value it can store is zero.



function conforms to ISO/IEC 9899:1990 (``ISO C90'').It was adopted by the System V, ANSI C and POSIX standards and bzero deprecated.


When porting to Solaris, here is possible ANSI/POSIX/SVR4 replacements for popular BSD functions:



Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s