From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs Date: Wed, 24 Nov 2010 20:55:07 +0200 Message-ID: <4CED5F8B.1080106@redhat.com> References: <4CED4276.9090103@redhat.com> <4CED445E.30105@redhat.com> <4CED4629.2060804@redhat.com> <4CED4738.2020406@redhat.com> <4CED488D.40806@redhat.com> <4CED4B0E.3030805@codemonkey.ws> <4CED4D36.3060708@redhat.com> <4CED4E5C.5020602@redhat.com> <20101124174311.GL20014@redhat.com> <4CED5074.5080908@redhat.com> <20101124181000.GA21364@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jes Sorensen , Anthony Liguori , Alexander Graf , Marcelo Tosatti , kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:3189 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753147Ab0KXSzS (ORCPT ); Wed, 24 Nov 2010 13:55:18 -0500 In-Reply-To: <20101124181000.GA21364@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/24/2010 08:10 PM, Gleb Natapov wrote: > On Wed, Nov 24, 2010 at 07:50:44PM +0200, Avi Kivity wrote: > > On 11/24/2010 07:43 PM, Gleb Natapov wrote: > > >> >Explicit code means you know what is going on, it means you can debug it > > >> >in gdb and match it. That is a *good* thing! > > >> > > >> Implicit code means that you don't need to debug it. The compiler > > >> gets it right every time. > > >> > > >Best joke ever! > > > > Do you encounter many compiler bugs in your daily work? > > > Bug can still be yours but all this virtual inheritance make it much > harder to understand what happens. No, it's easier, since there's a lot less code to chase. Of course, you have to learn the pattern in the language, but you do this once and keep reusing this. If it's emulated in C, you have to read all the code over and over again (in different uses), always on the lookout to see if it's exactly the same pattern, or if some bug crept in. > How is support for C++ debugging in > gdb this days? Last I debugged C++ was 5+ years ago. I had no complaints (though I'm a mostly printf debugger). > Can gdb tell type of object from object instance? Yes, provided it has at least one virtual function. Otherwise you only get the static type. In fact this is much better than C where you have to look up the ops table and perform the container_of() manually. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.