From owner-freebsd-chat@FreeBSD.ORG Sat Apr 22 21:43:12 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 53CF216A401 for ; Sat, 22 Apr 2006 21:43:12 +0000 (UTC) (envelope-from dugger@hotlz.com) Received: from www.hotlz.com (freedom.hotlz.com [209.20.218.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAAF343D45 for ; Sat, 22 Apr 2006 21:43:11 +0000 (GMT) (envelope-from dugger@hotlz.com) Received: from [172.27.240.45] (henry.local.hotlz.com [172.27.240.45]) by www.hotlz.com (8.13.3/8.13.3) with ESMTP id k3MLh8n6027302; Sat, 22 Apr 2006 14:43:08 -0700 (PDT) (envelope-from dugger@hotlz.com) Message-ID: <444AA36D.50506@hotlz.com> Date: Sat, 22 Apr 2006 14:43:09 -0700 From: Don Dugger User-Agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= References: <44490663.3040506@hotlz.com> <86d5f9pno8.fsf@xps.des.no> <444A6B54.1030902@hotlz.com> <86vet1o5j3.fsf@xps.des.no> <444A8106.5010801@hotlz.com> <86mzednwof.fsf@xps.des.no> In-Reply-To: <86mzednwof.fsf@xps.des.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: 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 21:43:12 -0000 Dag-Erling Smørgrav wrote: >Don Dugger writes: > > >>Dag-Erling Smørgrav writes: >> >> >>>Don Dugger writes: >>> >>> >>>>Dag-Erling Smørgrav writes: >>>> >>>> >>>>>Don Dugger writes: >>>>> >>>>> >>>>>>The fact is that all your c code will compile in c++ >>>>>> >>>>>> >>>>>That is wrong. To name just one example, C++ is much stricter about >>>>>type casts than C is. >>>>> >>>>> >>>>I mean the constructs. Casting will not change the functionality or >>>>shouldn't. >>>> >>>> >>>It does. Casting can be (and often is) used to force or avoid sign >>>promotion in function arguments; for instance, isspace(ch) may produce >>>incorrect results if ch is a char, so a cast to int is required. >>> >>>C allows any expression of pointer type to be assigned to a void *, >>>and allows any expression of type void * to be assigned to any object >>>pointer type. C++ does not. As a result, a typical C program which >>>uses malloc() without casting the result will not compile cleanly with >>>a C++ compiler. A competent C programmer will balk at adding the cast >>>that C++ requires; a competent C++ programmer will correctly point out >>>that a C++ program should not use malloc() anyway. >>> >>>There are other incompatiblities: const has different semantics in C >>>and C++, namespaces aren't quite the same (there is no separation >>>between the typedef namespace and the struct namespace in C++), etc. >>> >>> >>And how does that change my point? >> >> > >You claim (on the first line quoted above) that "all your c code will >compile in c++". I am trying to show that you are wrong. > >DES > > Ok I should have said most or some, but I'm taking about the original point which is that c++ is not where the performance problem comes from it's the code in the library or that was generated by the templates or many other thing and there are trade offs no matter what you use and that many of the things like iostreams come with a great deal of other functionality other then simply outputting a character to the screen and if you use iostreams your going to pay for that functionality with performance. You can however use the old c library stuff and get the same performance you got with c. In all the case I saw for comparisson he used things that were from iostrems. Don 8)