From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoXBC-0000D4-Ef for qemu-devel@nongnu.org; Fri, 08 Apr 2016 10:14:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoXB8-0005zR-B4 for qemu-devel@nongnu.org; Fri, 08 Apr 2016 10:14:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoXB8-0005zG-3f for qemu-devel@nongnu.org; Fri, 08 Apr 2016 10:14:30 -0400 References: <87r3fjpvgx.fsf@fimbulvetr.bsc.es> <56E046D3.2080709@twiddle.net> <87twkfo6tn.fsf@fimbulvetr.bsc.es> <56E0714F.1090602@twiddle.net> <878u1rnv36.fsf@fimbulvetr.bsc.es> <8737rujz5n.fsf@fimbulvetr.bsc.es> <871t7dh71t.fsf@blackfin.pond.sub.org> <87mvpa4zcc.fsf@fimbulvetr.bsc.es> <57067660.8030700@redhat.com> <87bn5ktf6w.fsf@dusky.pond.sub.org> From: Paolo Bonzini Message-ID: <5707BCC0.5010504@redhat.com> Date: Fri, 8 Apr 2016 16:14:24 +0200 MIME-Version: 1.0 In-Reply-To: <87bn5ktf6w.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC] [tcg] Idea on refactoring target code generation loop (gen_intermediate_code) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , Peter Crosthwaite , QEMU Developers , Richard Henderson On 08/04/2016 15:15, Markus Armbruster wrote: > > On the other hand, minimal usage of templates instead of some of the > > preprocessor gunk we have would be a very good thing IMNSHO. I am > > referring to the multiply included header files and to the macros wit= h > > type arguments (mostly QOM casts). > > > > I don't think we need more C++ than that, but using templates as > > basically a type-safe preprocessor would improve QEMU a little bit. > > More rarely, lambdas could replace some preprocessor magic too, but > > that's C11 and not many compilers support them. > > > > But I won't weep if people say no because we have a lot other > > low-hanging fruit to make QEMU better (especially the header file >=20 > "No!" (Hey, you asked for it) >=20 > Back to serious. As Peter Maydell said, "if we move away from C I'd > rather it to be a language that's nicer than C rather than one that's > uglier and larger and still retains all of C's flaws." Sure, except that one plan is feasible now and can be done in small steps; the other is not feasible now (for example Rust is not even packaged in Fedora) and entails pretty much a rewrite of the whole code base. > People sometimes propose to defang C++ by subsetting and/or coding > conventions. I'll take that seriously when I see the tool that > rigorously checks adherence to subset / convention. The problem with subsetting and conventions is that they always come with exceptions, besides the fact that no one writes the tool. So I prefer common sense :) and common sense says that a million-line codebase that mixes procedural, home-grown OO and language OO is going to stink from ten miles. And maintainers sit at most two feet from the screen. Really even just -Wc++-compat would be a nice improvement so we enjoy a little more type safety. IMHO, C++'s biggest tax is that Coccinelle does not like it. > > cleanups that Markus started and I want to conclude very early in 2.7= ). > > Speaking of which: the plan was you post yours for 2.7, and then I can > build on top (assuming there's useful work left), right? I have rebased my stuff already, but I'm going to disappear in about a week and for the first week or two after the 2.6 release (depending on whether it slips or not). Also, I will travel most of next week. So I either I'll post it soonish or it will have to wait a little. Anyhow, there's definitely useful work left from your last two patches, even more so after Veronia Bahaa cleaned up qemu-common.h substantially so there may be more pointless inclusions of it and fewer headers that really need it. Paolo