From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUUo8-00082L-Sq for qemu-devel@nongnu.org; Tue, 03 Feb 2009 18:35:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUUo5-0007xG-6S for qemu-devel@nongnu.org; Tue, 03 Feb 2009 18:35:56 -0500 Received: from [199.232.76.173] (port=50556 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUUo5-0007x0-0Q for qemu-devel@nongnu.org; Tue, 03 Feb 2009 18:35:53 -0500 Received: from mx20.gnu.org ([199.232.41.8]:33059) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LUUo4-0001lc-Ns for qemu-devel@nongnu.org; Tue, 03 Feb 2009 18:35:52 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUUo3-0001vB-Lx for qemu-devel@nongnu.org; Tue, 03 Feb 2009 18:35:51 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH v2 6/8] qemu:virtio-net: Enable filtering based on MAC, promisc, broadcast and allmulti Date: Tue, 3 Feb 2009 23:35:46 +0000 References: <20090203192932.19598.50925.stgit@kvm.aw> <4988AECB.2070208@codemonkey.ws> In-Reply-To: <4988AECB.2070208@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200902032335.48083.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , markmc@redhat.com, kvm@vger.kernel.org > >> + static uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; > > > > 'const'? > > It may be good practice but practically speaking, I don't think it will > generate different code. The only thing that uses bcast is memcmp() > which should be a builtin. Since bcast doesn't otherwise escape the > function, it's an obvious candidate for optimization. I think the > compiler already has enough information that const doesn't tell it > anything more. const is as much for the programmer as the compiler[1]. Modifying this variable is just plain wrong, so it's a good idea to let the compiler enforce that. Paul [1] In many cases (especially when combined with pointers) "const" doesn't actually mean what may people think it does. Ask your local C language expert if you don't know what I'm talking about.