From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45053 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsNp4-0006Cb-50 for qemu-devel@nongnu.org; Wed, 23 Feb 2011 18:08:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsNp2-0005Ix-VM for qemu-devel@nongnu.org; Wed, 23 Feb 2011 18:08:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsNp2-0005It-Ln for qemu-devel@nongnu.org; Wed, 23 Feb 2011 18:08:40 -0500 From: Juan Quintela In-Reply-To: <4D659295.1070400@codemonkey.ws> (Anthony Liguori's message of "Wed, 23 Feb 2011 17:04:53 -0600") References: <8b675b6ffee29ec15f2b73a9fd47e334429f5c5c.1298492768.git.quintela@redhat.com> <4D6587C7.6030604@codemonkey.ws> <4D659295.1070400@codemonkey.ws> Date: Thu, 24 Feb 2011 00:07:11 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 16/28] migration: use global variable directly Reply-To: quintela@redhat.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori wrote: > On 02/23/2011 04:46 PM, Juan Quintela wrote: >> Anthony Liguori wrote: >> >>> On 02/23/2011 03:47 PM, Juan Quintela wrote: >>> >>>> We are setting a pointer to a local variable in the previous line, just use >>>> the global variable directly. We remove the ->file test because it is already >>>> done inside qemu_file_set_rate_limit() function. >>>> >>>> >>> I think this is bad form generally speaking. Globals are not >>> something to be embraced but rather to be isolated as much as humanly >>> possible. >>> >> current_migration is a global variable. >> >> And just doing: >> >> s = current_migration; >> >> foo(s); >> >> helps nothing. > > It's still bad form IMHO. You should always use local variables to > reference global variables unless you're explicitly setting a global > variable. Obviounly tastes change between us :-( If I want to do that, instead of creating a local variable, I will just add a parameter to the function and make the callers to pass it. For me, a variable in a function is global or local, hidden it as a local has no merit. Later, Juan.