From owner-freebsd-chat@FreeBSD.ORG Sat Apr 22 21:10:48 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 5AD4E16A415 for ; Sat, 22 Apr 2006 21:10:48 +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 31C9043D58 for ; Sat, 22 Apr 2006 21:10:46 +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 8BD6B2083; Sat, 22 Apr 2006 23:10:41 +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 10F432082; Sat, 22 Apr 2006 23:10:41 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id E2B8433C31; Sat, 22 Apr 2006 23:10:40 +0200 (CEST) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Don Dugger References: <44490663.3040506@hotlz.com> <86d5f9pno8.fsf@xps.des.no> <444A6B54.1030902@hotlz.com> <86vet1o5j3.fsf@xps.des.no> <444A8106.5010801@hotlz.com> Date: Sat, 22 Apr 2006 23:10:40 +0200 In-Reply-To: <444A8106.5010801@hotlz.com> (Don Dugger's message of "Sat, 22 Apr 2006 12:16:22 -0700") Message-ID: <86mzednwof.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: 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:10:48 -0000 Don Dugger writes: > Dag-Erling Sm=F8rgrav writes: > > Don Dugger writes: > > > Dag-Erling Sm=F8rgrav 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 --=20 Dag-Erling Sm=F8rgrav - des@des.no