[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/common/lib/libc/string
On Mon, 14 Apr 2014, Joerg Sonnenberger wrote:
Using bcopy/memcpy with NULL arguments is valid as long as the size is
No, it's undefined behaviour. C99 section 7.21.1:
Unless explicitly stated otherwise in the description of a
particular function in this subclause, pointer arguments on
such a call shall still have valid values, as described in
and 7.1.4 says:
If an argument to a function has an invalid value (such as ...
a null pointer ...) ..., the behavior is undefined.
and 220.127.116.11 "The memcpy function" does not give any explicit
permission for use of null pointers.
I don't object if the implementation wants to allow null pointers
with zero size as an extension, but it should be clear that this
--apb (Alan Barrett)
Main Index |
Thread Index |