Date: Fri, 26 Jul 2013 10:49:47 +0100 From: David Chisnall <theraven@FreeBSD.org> To: mdf@FreeBSD.org Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "svn-src-all@freebsd.org" <svn-src-all@FreeBSD.org>, "svn-src-head@freebsd.org" <svn-src-head@FreeBSD.org>, Tim Kientzle <kientzle@FreeBSD.org>, Bruce Evans <brde@optusnet.com.au>, Hans Petter Selasky <hps@bitfrost.no> Subject: Re: svn commit: r253636 - head/sys/vm Message-ID: <7B55F378-E6E8-4CFA-95DC-4E37A45C48FC@FreeBSD.org> In-Reply-To: <CAMBSHm-hPkiraSBQzRpwdgGdCsKUBA%2BusxYtNsjKujqU4dWU2A@mail.gmail.com> References: <201307250348.r6P3mbsG049595@svn.freebsd.org> <20130725171038.O841@besplex.bde.org> <51F0DDB0.7080102@bitfrost.no> <73FCA347-5EB9-445F-A25C-D06CA137CBEE@FreeBSD.org> <CAMBSHm-hPkiraSBQzRpwdgGdCsKUBA%2BusxYtNsjKujqU4dWU2A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 25 Jul 2013, at 16:10, mdf@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 #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJR8kY7AAoJEKx65DEEsqIdtOAP/1UVc5r0JbJ30v+lPvd3Ji8f 7OKZMbmYvMjvDnfSQ8ECcsQ15dPyp2BI+xIMjN+P8nqj63C0xMiA4HnoujjBQ9WB 2uL+xC4KXp3ka4l7cOvpe0W4dndSJtfOF9q9mCHudM4Hdk6g1F2LPpCzaQ/GmEBm aSVl+royEKpRlhGtpAc7SHz95VtgXijFr+u3dh+PTHqCa0YEZz5gDvprmJeDiTYI 2sGQdTxziRM0fpj2FI4iJQMbMEctYdwjYpgGjud0WGyDllQjdjpqkK/PReOvcpb1 jfvr6oLVi8bW3yQYqAXYXLz5l9GKZuZwuKQwjne8uONZ1HNZL68bddaWcAjsEeVV 2kyJjRpUe5y4it58rfENy6rVIedWP8n+tX1lRMyVr8aOAnlCIsHLdD+g2/9KnHNL mAbfrJ78lpPH4XHNW913so4XaGZYjlOMfBq3OFb7mvr/Z4eZ7/6wqcpGHTy+geAD o1RX++20D7NCN4w/0cb0qVL0EAAdCd+KZJlrLkeefTgG4N9KR+w4ZA4HcpYtwFMi 8/j6LHXCC28+CcmD9re8Xbw7plkegXC3ZY+W+00BUUuYeGEvVLp+1U8B4/L6Ax8r i1jkgVBY2VNaaWzHzdgiVNEDqkFZ6TaOepU3ArBb4k35mztj+Yvkt+lFfHz7x0ee IARJymg4fyJ39oxUHEl1 =cTWO -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7B55F378-E6E8-4CFA-95DC-4E37A45C48FC>
