From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 11 21:30:07 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCD4F16A4DA for ; Tue, 11 Jul 2006 21:30:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFDB543D64 for ; Tue, 11 Jul 2006 21:30:02 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k6BLQSUl047236; Tue, 11 Jul 2006 15:26:29 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 11 Jul 2006 15:26:38 -0600 (MDT) Message-Id: <20060711.152638.-1625881074.imp@bsdimp.com> To: mag@intron.ac From: "M. Warner Losh" In-Reply-To: <1152642474.29859@origin.intron.ac> References: <20060711152949.GB1463@merlin.emma.line.org> <1152642474.29859@origin.intron.ac> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 11 Jul 2006 15:26:29 -0600 (MDT) Cc: freebsd-hackers@freebsd.org, matthias.andree@gmx.de Subject: Re: kern/99979: Get Ready for Kernel Module in C++ X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jul 2006 21:30:07 -0000 In message: <1152642474.29859@origin.intron.ac> mag@intron.ac writes: : Why do you all consider importing C++ code to FreeBSD kernel to be so : complicated at the beginning? Many people reading this list have conducted experiments in the past at various employers. Everyone who has conducted the experiments reports that the 'trivial' parts of C++ are trivial to do in the kernel. new/delete support is easy. Subclassing is easy, so long as it is single inheritance. Some limited template support is possible. Exceptions can be made to be not too bad, but at the expense of much of the exception functionality. If you look at the number of weasil words I used here to describe the functionality, you'll see that the 'easy' parts of C++ aren't a very large subset of the entire language, and many would argue aren't a useful enough subset to be worth the efforts to clean up the code and make it production quality. However, C++ has so many standard libraries and interfaces that importing them into the kernel is a daunting task. STL is right out, for example, as are the insertion and extraction operators. Also, g++ has traditionally produced worse code for C++ than for C, even when the source is identical. This stems mainly from subtle differences in the semantics of the two languages. This was true in 2.3 times, in 2.4 times, and is still true with 3.4.4 that we have in current, although a few simple tests indicates that things have gotten much better. Basically, people here have tried it in the past and given up. They are very leery of any changes in this direction, and need some sort of proof to be convinced otherwise. Warner