From owner-freebsd-hackers Tue Mar 5 6:55:39 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from maile.telia.com (maile.telia.com [194.22.190.16]) by hub.freebsd.org (Postfix) with ESMTP id E27E437B41A for ; Tue, 5 Mar 2002 06:55:33 -0800 (PST) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by maile.telia.com (8.11.6/8.11.6) with ESMTP id g25EtWH22522 for ; Tue, 5 Mar 2002 15:55:32 +0100 (CET) Received: from falcon.midgard.homeip.net (h217n1fls20o913.telia.com [212.181.162.217]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id PAA02657 for ; Tue, 5 Mar 2002 15:55:32 +0100 (CET) Received: (qmail 74036 invoked by uid 1001); 5 Mar 2002 14:55:31 -0000 Date: Tue, 5 Mar 2002 15:55:31 +0100 From: Erik Trulsson To: "Eugene L. Vorokov" Cc: freebsd-hackers@freebsd.org Subject: Re: C vs C++ Message-ID: <20020305145531.GA73995@student.uu.se> Mail-Followup-To: "Eugene L. Vorokov" , freebsd-hackers@freebsd.org References: <200203051407.g25E7Cd67446@bugz.infotecs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200203051407.g25E7Cd67446@bugz.infotecs.ru> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Mar 05, 2002 at 05:07:12PM +0300, Eugene L. Vorokov wrote: > Hello, > > I have a small problem. I work for software development company and > write daemons and console tools for Unix. My boss wants everything > to be written in C++, because he thinks C++ is cool. I prefer C > for such tasks, but I cannot really put good arguments of why and > where C++ can be worse than C. I know many of you prefer C too. > Can you please explain some disadvantages of C++ comparing to C ? > Is it slower, does it produce less effective code, why is it like > that, etc ... or please direct me to some articles where this can > be explained. Properly used there are not really any disadvantages of C++ over C. Since C is (almost) a subset of C++, most C programs will work just the same when compiled as C++. Proper use of the various extra features of C++ can make programs easier to write and make them more maintainable but this requires that the programmer actually know how to use them. The main difference between C++ and C is the support for object-oriented programming. One can of course write in an object-oriented manner in almost any programming language, including C, but it is easier in languages that has direct support for it, like C++. Now, not all problems are well-suited for being solved with an object-oriented approach so in those cases the extra features of C++ won't be of much help. I suspect that for the type programs you are writing using C++ wouldn't really have any advantage over C, but it won't have any disadvantage either. Does your boss insist on you actually writing your programs in idiomatic C++ or would he be satisfied if you wrote them using a subset of C++ which is very close to C. (if the latter your programs would still look almost the same as before, while technically being written in C++.) Using something just because 'it is cool' is just about the worst reason there is of doing anything (closely followed by 'we have always done it this way' which seems to be your reason :-) .) > > I apologize for the offtopic whenever it happens, but this issue > really pisses me off now. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message