From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 21 18:21:59 2005 Return-Path: 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 90B9616A4CE for ; Thu, 21 Apr 2005 18:21:59 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37C5C43D45 for ; Thu, 21 Apr 2005 18:21:59 +0000 (GMT) (envelope-from opensource.enthousiat@gmail.com) Received: by zproxy.gmail.com with SMTP id 9so730174nzo for ; Thu, 21 Apr 2005 11:21:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pSa/Gb1yzoO1kBLNurMFe9BCHbu8UEdpLghDm+omVv9/HcLqMsRHEBpPdChypYdpT3fA4q0gN6Tys+jp/VgCwOwSyzmcr0LEjJtt2bgT5+xFhxURFmHT9qN0m0Nf+igh2aqLIRevjYh23lHndgrz9tj3ii0tlLEgvFfaYL8QdXM= Received: by 10.36.41.20 with SMTP id o20mr212174nzo; Thu, 21 Apr 2005 11:21:58 -0700 (PDT) Received: by 10.36.109.8 with HTTP; Thu, 21 Apr 2005 11:21:58 -0700 (PDT) Message-ID: <37e1316605042111215c201be9@mail.gmail.com> Date: Thu, 21 Apr 2005 14:21:58 -0400 From: Aziz KEZZOU To: Chuck Robey In-Reply-To: <42670F63.4000901@chuckr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <37e1316605042019072b5d7a0e@mail.gmail.com> <5bbfe7d4050420191316a629b7@mail.gmail.com> <42670F63.4000901@chuckr.org> cc: David Leimbach cc: hackers@freebsd.org Subject: Re: KLD module with C++ iostreams ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Aziz KEZZOU List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2005 18:21:59 -0000 > David Leimbach wrote: > > Interesting question. People usually have to implement the C++ > > runtime to be usable from within the kernel. Things like exceptions > > and "stdout" may not be defined in kernel space :) > > > > I'm not terribly familiar with how it works on FreeBSD but I know it > > took a special effort to get C++ support into linux. > > > > Dave > > > > On 4/20/05, Aziz KEZZOU wrote: > > > >>Hi hackers, > >>I am wondering if I can use c++ iostreams inside the kernel ? > >>After all the code : cout << "Hello world!" << endl; > >>ends accessing the stdout just like : printf("Hello world!\n"); right ? >=20 > No, that's not true, all the iostreams stuff is totally independent. > The iostreams stuff is coming from some of the ugliest code in C++. > But, that's not the question, or at very least, it shouldn't BE the > question. There is ZERO need to bring in features from C++, all it will > do is to directly confuse the code base by greatly adding to the > complexity of the code, without giving anything like equivalent features. >=20 > Some very, very elegant work has been code, OO-ing the kernel code, > adding OO features, all without violating the C language code base. > Adding in C++ features over stdio stuff is so senseless, it's nearly > obscene. >=20 > If the gain at the end of the road was large enough, I wouldn't be > against it so stridently, but I see *so* little gain. >=20 > BTW, you know where the ugliest code in computer science today is: half > is in the actual implementation of the cstdio/template code, the other > half is the iostreams stuff. The fact that they energize some very > elegant code is causing many folks never to see the fact of the horrible > code lumps that exist out in the backyard. >=20 > >> > >>So if I could compile my KLD module with static linkage to libstdc++, > >>that should be ok, right ? > >> > >>Any one did or knows how to do this ? > >> Thank you guys for responding to my post. Certainly, it is not a good idea to use _all_ C++ stuff inside the kernel ; in the linux community a similar suggestion resulted in a big discussion of pros & cons. I was asking because I have a big portion of C++ code that I am planning to move inside the kernel. But, having compared the effort/time required to port C++ iostreams into the kernel and the effort/time required to get rid of iostreams , I think I will abandon this challenge for now ;-) Just to let you know "virtual methods" and "templates", among others, are supported inside the kernel... Greetings, -aziz