From owner-freebsd-chat@FreeBSD.ORG Sat Apr 22 17:36:07 2006 Return-Path: X-Original-To: freebsd-chat@freebsd.org Delivered-To: freebsd-chat@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC37816A406 for ; Sat, 22 Apr 2006 17:36:07 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CC4243D5A for ; Sat, 22 Apr 2006 17:36:06 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 71BE72088; Sat, 22 Apr 2006 19:36:01 +0200 (CEST) X-Spam-Tests: AWL,BAYES_00,FORGED_RCVD_HELO X-Spam-Learn: ham X-Spam-Score: -2.4/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on tim.des.no Received: from xps.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id E87DC2087; Sat, 22 Apr 2006 19:36:00 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id C68B633C31; Sat, 22 Apr 2006 19:36:00 +0200 (CEST) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Don Dugger References: <200604221603.k3MG3rmI003382@mist.nodomain> <444A64A3.2020208@hotlz.com> Date: Sat, 22 Apr 2006 19:36:00 +0200 In-Reply-To: <444A64A3.2020208@hotlz.com> (Don Dugger's message of "Sat, 22 Apr 2006 10:15:15 -0700") Message-ID: <86zmido6m7.fsf@xps.des.no> User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Dan Strick , freebsd-chat@freebsd.org Subject: Re: Why is not more FreeBSD software written in C++? X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Apr 2006 17:36:08 -0000 Don Dugger writes: > But "streams" have been around a lot longer then c++. I first encountered > them in AIX protocol stacks. Didn't like 'em then either. SysV streams and C++ I/O streams are completely unrelated (except that they both originated at AT&T and one probably inspired the other) > Although the idea of pushing functional units down a pipe does seem > interesting, however I have never found it works very well in > practice, and the reason was always performance. No "functional units" are being "pushed down the pipe" with C++ I/O streams. The << stuff is mere syntactic sugar. What happens is simply that the correct function is called to format each element and pass it to the output stream. > I think the problem is in fact is a general problem the more under > lying functionality you have the less performance. Wrong. Higher-level constructs allow the compiler more latitude to optimize the code. This is why well-written Lisp, for instance, can outperform well-written C (provided you use a decent Lisp compiler). > If you need to you can use the c lib stuff and only use the c++ > added functionality when it pays to. After all some of the c++ stuff > is just better, "//" comments and passing by reference and etc. // comments are neither better nor worse than /* */ comments, and they have been available in C for seven years now. C++ references are very nice, but almost impossible for a non-expert to use properly (any object passed by reference *must* be of a class which has a correctly designed copy constructor) > I think the reason streams was added to c++ early on was that a lot > of people didn't like printf(), the found it hard to use, which I > never understood. Nobody claims printf() is hard to understand, but it is neither extensible nor type-safe. What C++ lacks to be a top-notch OO language is garbage collection and iterators which aren't a PITA to use. Both will be present in C++0x. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no