From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38544 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDXoU-0002uI-2Z for qemu-devel@nongnu.org; Wed, 03 Nov 2010 03:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDXoR-0001YN-A0 for qemu-devel@nongnu.org; Wed, 03 Nov 2010 03:31:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDXoR-0001Xh-38 for qemu-devel@nongnu.org; Wed, 03 Nov 2010 03:31:15 -0400 Date: Wed, 3 Nov 2010 09:30:49 +0200 From: "Michael S. Tsirkin" Message-ID: <20101103073049.GB6772@redhat.com> References: <7e0bd57a938864f2bb60651f975f5bcaf042c4f2.1288689399.git.yamahata@valinux.co.jp> <20101102125712.GB29655@redhat.com> <20101103012430.GA26077@valinux.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101103012430.GA26077@valinux.co.jp> Subject: [Qemu-devel] Re: [PATCH v7 2/6] pcie/aer: helper functions for pcie aer capability List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: skandasa@cisco.com, adnan@khaleel.us, etmartin@cisco.com, qemu-devel@nongnu.org, wexu2@cisco.com On Wed, Nov 03, 2010 at 10:24:30AM +0900, Isaku Yamahata wrote: > On Tue, Nov 02, 2010 at 02:57:12PM +0200, Michael S. Tsirkin wrote: > > > +static void pcie_aer_clear_error(PCIDevice *dev); > > > +static void pcie_aer_msg(PCIDevice *dev, const PCIEAERMsg *msg); > > > + > > > > so what exactly is the order of calls that makes > > removing the forward declarations impractical? > > Is there a recursive call? If yes I'd like to > > see it documented much better. > > Why do you think forward declaration is so bad? > I don't see any such consensus and I don't think they aren't > accused generally like goto. > Can you please elaborate why you're trying so hard to prevent it? Well no, I do not claim they are that bad. In my opinion avoiding them just makes for a slightly better code usually: - They make for code duplication where if you change a function there's another place to edit. - Just generally add more code. - Avoiding forward declarations makes you put functions in some sensible order. - Also makes you avoid recursion where a loop will do. But all this doesn't always apply. I was trying to understand whether there's recursion here that I am missing. If there is a comment might be helpful. > -- > yamahata