From owner-svn-src-head@FreeBSD.ORG Thu Jul 25 11:44:07 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 22024CA3; Thu, 25 Jul 2013 11:44:07 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C5C69237C; Thu, 25 Jul 2013 11:44:06 +0000 (UTC) Received: from [192.168.0.2] (cpc27-cmbg15-2-0-cust235.5-4.cable.virginmedia.com [86.27.188.236]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id r6PBhsnL039111 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 25 Jul 2013 11:43:56 GMT (envelope-from theraven@FreeBSD.org) Content-Type: multipart/signed; boundary="Apple-Mail=_9FD02FE0-1BE7-4720-B810-D2F9C8BF31BE"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: svn commit: r253636 - head/sys/vm From: David Chisnall In-Reply-To: <51F0DDB0.7080102@bitfrost.no> Date: Thu, 25 Jul 2013 12:43:49 +0100 Message-Id: <73FCA347-5EB9-445F-A25C-D06CA137CBEE@FreeBSD.org> References: <201307250348.r6P3mbsG049595@svn.freebsd.org> <20130725171038.O841@besplex.bde.org> <51F0DDB0.7080102@bitfrost.no> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1503) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Tim Kientzle , src-committers@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jul 2013 11:44:07 -0000 --Apple-Mail=_9FD02FE0-1BE7-4720-B810-D2F9C8BF31BE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On 25 Jul 2013, at 09:11, Hans Petter Selasky wrote: > The structure looks like some size, so bzero() might run faster than = memset() depending on the compiler settings. Should be profiled before = changed! They will generate identical code for small structures with known sizes. = Both clang and gcc have a simplify libcalls pass that recognises both = functions and will elide the call in preference to a small set of inline = stores. However(), memset is to be preferred in this idiom because the compiler = provides better diagnostics in the case of error: bzero.c:9:22: warning: 'memset' call operates on objects of type 'struct = foo' while the size is based on a different type 'struct foo *' [-Wsizeof-pointer-memaccess] memset(f, 0, sizeof(f)); ~ ^ bzero.c:9:22: note: did you mean to dereference the argument to 'sizeof' = (and multiply it by the number of elements)? memset(f, 0, sizeof(f)); ^ The same line with bzero(f, sizeof(f)) generates no error. David --Apple-Mail=_9FD02FE0-1BE7-4720-B810-D2F9C8BF31BE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org iQIcBAEBAgAGBQJR8Q92AAoJEKx65DEEsqId+bEP/Rm3oxEzblD4n+MTtd3dwjvt RV5eSDHKFV5GyRMtvggrQy10NPulZDjiRLCzIivbpM9ybDOg+sxTUrRJn+2FOp9i GBuvX543BO4TTtxkpBdk69HCwe5iiAfNdO7Ls/FfDFYDJodVyPQf8GG8/pvyTNJ+ 9s3mjdoUc3Wv+nTkWY5QJQvV0Mibn5+NeO1oLDEznbhihcIVDOovTMN2iY0NfcLb aAKdTQt41PwIE3Jml67HIEgbSRIo79Eind8kDUfkK/nqx8+Yw2tbECZsDZPDkUIX dMcyoSen+GKjpq45NHfIYU3TP4vUdbIxCbopbK9gBddHYWdHOKCGqW7DTmZZXoHU odnSoCldpMy7q2nmeqIea22KX0DVNbUGPpy95WNCLf0BAE2afHiJYaKD0AEkEkx8 bpy27cBgYWidUifzbrwOxD3t9GJTFY0wkRXdg+j7JHP8mrlEGOalEflrlmj27NJ3 P+xflWSOk2nFWyg91Kw6XlsLD+pLmZeMEX2ILZbdv9f1T/EfhTgpjzQ8ug2WsFsq TCVWCLnMN8itFphngLmLwUyHaY+8k66XLfr4LLSzH+yh4CmWtOJtLz/07eJEhiV7 DBZmmeyoqf2quYdNXWrXrzBk1smpI0Lvm8/yFAeICZPkOzxGI7u9+XxpJPJ9XI2h bmB9v3wloqdzhSUKNm79 =9SVh -----END PGP SIGNATURE----- --Apple-Mail=_9FD02FE0-1BE7-4720-B810-D2F9C8BF31BE--