Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: Seeking critique(s) of C++ Message-ID: <633@taumet.com> Date: 23 Mar 91 19:50:48 GMT References: <1991Mar20.015750.9487@dbase.A-T.COM> Organization: Taumetric Corporation, San Diego Lines: 46 tomr@dbase.A-T.COM (Tom Rombouts) writes: >To start things off, here are some comments by a knowledgeable >friend of mine... I think your friend is less knowledgeable than he thinks he is. >2. Difficulty of mixing and matching classes from different >vendors/sources. How is this less of a problem in C? In some OO languages, everything is derived from the mother of all super-classes, which makes integration of new classes easier (execpt for name clashes). C++ deliberately does not do this, because runtime efficiency was considered a more important goal. (You can choose your own goals.) >3. Great expertise required to properly build classes from scratch. True in any language at any time. It is even harder in languages which do not have data structuring. Classes actually simplify the process, as you can properly modularize your design. >4. Certain things (he used the example of a stack class) just >have too much overhead and must be done in "regular" C anyway >to get adequate performance. False. C++ typically involves less overhead to accomplish the same task than C, especially if you are using a compiler which goes directly to object code rather than via C intermediate code. I cite as an example a project of our own of about 30,000 lines of source code which we are converting from C to C++. We have converted all the string processing to use carefully designed string and storage- management classes, and achieved a 20% reduction in both source and object code size. We haven't measured the runtime improvement precisely, but the code is faster. The operations we do could be simulated in C code, but the C code would be very hard to understand, use, debug, and modify. The C++ code is very straightforward. I challenge your friend to write a stack class in conforming ANSI C which I cannot write at least as efficiently in C++. (He can't win, since his program will also be a C++ program, possibly with minor adjustments.) But I think I my C++ program will be more reliable and easier to use than the C program he writes, and at least as efficient. -- Steve Clamage, TauMetric Corp, steve@taumet.com