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 19:11:20 +0200 Message-ID: <4CED4738.2020406@redhat.com> References: <1290595933-13122-1-git-send-email-avi@redhat.com> <1290595933-13122-3-git-send-email-avi@redhat.com> <50DD1E97-0ECD-41E6-B6F8-1D78AA4A4876@suse.de> <4CED2416.1040102@codemonkey.ws> <20101124154006.GE15111@redhat.com> <4CED344B.3030000@codemonkey.ws> <4CED3FE6.50900@redhat.com> <4CED41A0.8060003@redhat.com> <4CED4276.9090103@redhat.com> <4CED445E.30105@redhat.com> <4CED4629.2060804@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Gleb Natapov , Alexander Graf , Marcelo Tosatti , kvm@vger.kernel.org To: Jes Sorensen Return-path: Received: from mx1.redhat.com ([209.132.183.28]:3469 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755691Ab0KXRL1 (ORCPT ); Wed, 24 Nov 2010 12:11:27 -0500 In-Reply-To: <4CED4629.2060804@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/24/2010 07:06 PM, Jes Sorensen wrote: > On 11/24/10 17:59, Avi Kivity wrote: > > On 11/24/2010 06:51 PM, Jes Sorensen wrote: > >> Right we need good design for our C code, which we are lacking to a > >> large extend. However that has nothing to do with the language, that has > >> to do with the developers. > > > > I'm sure patches will be welcome. > > > > C++ doesn't enforce good design. But it allows a good design to be > > enforced. > > Sorry but that is utterly and completely bogus! The enforcement is only > as good as the developers and maintainers make it, class File { public: virtual ~File() {} virtual void read(...) = 0; virtual void write(...) = 0; }; Anyone wishing to implement this interface is forced to implement read and write methods (callbacks) with exactly the right signature. The compiler will complain if they don't. So if File is a good interface, we can make the compiler force people to use it correctly. We can emulate this in C with ->ops-> things, but that's just boilerplate and more places for people to get things wrong, or lazy and take shortcuts. -- error compiling committee.c: too many arguments to function