Received: from eggs.gnu.org ([2001:4830:134:3::10]:58496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgOOO-0003jv-P7 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 22:10:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgOOL-00052E-Cj for qemu-devel@nongnu.org; Thu, 09 Apr 2015 22:10:00 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:34024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgOOL-000526-4p for qemu-devel@nongnu.org; Thu, 09 Apr 2015 22:09:57 -0400 Received: by pacyx8 with SMTP id yx8so6478889pac.1 for ; Thu, 09 Apr 2015 19:09:56 -0700 (PDT) Date: Fri, 10 Apr 2015 12:07:36 +1000 From: "Edgar E. Iglesias" Message-ID: <20150410020736.GB28944@toto> References: <1428437400-8474-1-git-send-email-peter.maydell@linaro.org> <1428437400-8474-2-git-send-email-peter.maydell@linaro.org> <20150409085537.GA30629@toto> <55264496.70702@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55264496.70702@redhat.com> Subject: Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Peter Crosthwaite , Patch Tracking , QEMU Developers , Greg Bellows , Alex =?iso-8859-1?Q?Benn=E9e?= , Richard Henderson On Thu, Apr 09, 2015 at 11:21:26AM +0200, Paolo Bonzini wrote: > > > On 09/04/2015 11:04, Peter Maydell wrote: > > We discussed this last time round, I think. Whether structs get > > passed in registers depends on the host CPU ABI/calling convention. > > Because of C++, structs up to pointer size are in practice always passed > in registers. 64-bit structs may or may not. > > The main advantage of structs is that it's impossible to mismatch the > parameter order. That even trumps readability in my opinion. > > I'm ambivalent, but I wouldn't mind at all using structs. Thanks for clarifying that Paolo. Yes, the manual bit masking and shifting is easier to get wrong. The struct also has stronger type checking in a way, as you cant OR in literals that are out of bounds. (IIRC GCC will even warn you for free). The struct is also easy to extend if we ever run out of bits in the uint64_t. Peter, would you consider switching to struct or are you still convinced of the pure uint64_t approach? Cheers, Edgar