Date: Sat, 22 Apr 2006 19:36:00 +0200 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Don Dugger <dugger@hotlz.com> Cc: Dan Strick <strick@covad.net>, freebsd-chat@freebsd.org Subject: Re: Why is not more FreeBSD software written in C++? Message-ID: <86zmido6m7.fsf@xps.des.no> In-Reply-To: <444A64A3.2020208@hotlz.com> (Don Dugger's message of "Sat, 22 Apr 2006 10:15:15 -0700") References: <200604221603.k3MG3rmI003382@mist.nodomain> <444A64A3.2020208@hotlz.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Don Dugger <dugger@hotlz.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86zmido6m7.fsf>