From owner-freebsd-hackers Tue Mar 5 17:12: 8 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from avocet.prod.itd.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50]) by hub.freebsd.org (Postfix) with ESMTP id 6D5B837B416 for ; Tue, 5 Mar 2002 17:12:04 -0800 (PST) Received: from pool0228.cvx40-bradley.dialup.earthlink.net ([216.244.42.228] helo=mindspring.com) by avocet.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16iPxF-0001jI-00; Tue, 05 Mar 2002 17:10:53 -0800 Message-ID: <3C856C7F.5005E30E@mindspring.com> Date: Tue, 05 Mar 2002 17:10:23 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "Brian T.Schellenberger" Cc: Kenneth Culver , "Steve B." , "Eugene L. Vorokov" , freebsd-hackers@FreeBSD.ORG Subject: Re: C vs C++ References: <20020305132457.A4700-100000@alpha.yumyumyum.org> <3C8529DA.FA8ABCE@mindspring.com> <20020305214127.545FDBA03@i8k.babbleon.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 "Brian T.Schellenberger" wrote: > On Tuesday 05 March 2002 03:26 pm, Terry Lambert wrote: > > Kenneth Culver wrote: > > > Why are you being so sarcastic? Everyone here is assuming that it's > > > harder to write C++ code, so you should only use it if necessary. It > > > isn't necessary to use it for something like a daemon. > > > > Because that underlying assumption is false, and I'm making > > fun of it. > > Reality check: How can you possibly contend that it is no more difficult to > write code in a language which *so* much more massive? It's not "*so* much more massive". Hardly anyone who wants to write understandable code uses operator overloading, unless the are definiing a "String" or "ImaginaryNumber" class, and then it's incredibly clear-cut what's going on. The "private" vs. "public" is incredibly useful for data hiding, as well as namespace seperation. It means you can't spam values accidently, if you can't spam them on purpose. If you have a hard time with "default private", then use "struct" instead of "class" for declaring things, and the default will be "public" instead. The "protected" and "friend" features are seldom used; if you understand FORTRAN mutual recursion as a means of implementing recursion in FORTRAN, which doesn't support it by default, then you understand "friend" functions. Inheritance is logical, to anyone who has ever programmed in the FreeBSD networking stack or VM system, both of which use structure casts to implement inheritance, whether you want it or not. Multiple inheritance is like "protected"... for the most part, you can ignore it. > And one, I might add, which is intentionally UNdesigned. Yeah, and ANSI-C has prototypes because the compiler vendors were too damn lazy to change their object format to include a third field in the symbol table so that the problems that prototypes catch at compile time could be caught at link-time. The hidden reason for ANSI-C prototypes, of course, is, and always has been, "so that C code could be compiled with a C++ compiler, with the intent that the C++ language supercede the C language". So now, I expect you to vehemently protect the existance of ANSI-C prototypes at every future opportunity. C++ was designed, but the design was constrained by the C language, just as the design of ANSI-C was constrained by the C language. > C++ is a language which I really liked until I really started > to learn about it. Well, there's a "ringing" condemnation. Have you looked at the source code for libXt or libXm lately? Ah, the beauty of pure C code, applied to the Object Oriented programming model... Object oriented programming is not some mystery, it's a means of solving problems that are best modeled by abstracting implementation details complexity into objects, so that you can concentrate on writing the code, and not on the details of the implementation. It's also a way of enhancing code reusability, through the use of design patterns. Once you've written one binary search, you've written them all. If you understand functional decomposition, then you unsertand the most fundamental tenet of object oriented programming already. Can we all move on to something more useful, like criticizing Java? -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message