From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <200902032335.48083.paul@codesourcery.com> References: <20090203192932.19598.50925.stgit@kvm.aw> <4988AECB.2070208@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Blue Swirl , markmc@redhat.com, kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from mail.codesourcery.com ([65.74.133.4]:56539 "EHLO mail.codesourcery.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751500AbZBCXfw (ORCPT ); Tue, 3 Feb 2009 18:35:52 -0500 In-Reply-To: <4988AECB.2070208@codemonkey.ws> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: > >> + 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.