On 25 Jul 2013, at 16:10, m...@freebsd.org wrote:

> Isn't that a compiler bug?  memset(p, 0, n) is the same as bzero(p, n).  Why 
> would the compiler warn on one and not the other?

They are different.  memcpy is defined by the C standard.  bzero is defined by 
POSIX.  When you are compiling C code, the compiler is free to assume behaviour 
of any C standard functions but not of POSIX functions because it does not know 
that you are compiling for a POSIX target (possibly it should do this if the 
relevant POSIX macros are set).  

As Bruce says, however, the C standard excludes memset() and memcpy() in 
freestanding environments (which is a shame, because a lot of optimisations 
depend on their existence, and something I had thought was fixed in C11), so 
this is not relevant in the kernel.

> Does clang have a similar bias for memcpy versus bcopy?

Almost certainly.

David

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to