Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!atha!aunro!ukma!dftsrv!nssdca.gsfc.nasa.gov!njacobs From: njacobs@nssdca.gsfc.nasa.gov (Nick Jacobs) Newsgroups: comp.object Subject: Re: C++ vs. C Summary: No difference in efficiency Message-ID: <5111@dftsrv.gsfc.nasa.gov> Date: 26 Apr 91 11:37:04 GMT References: <1991Apr24.125926.5146@asc.slb.com> <18905@crdgw1.crd.ge.com> <1991Apr25.213211.24114@asc.slb.com> Sender: news@dftsrv.gsfc.nasa.gov Reply-To: njacobs@nssdcs.gsfc.nasa.gov Followup-To: comp.object Lines: 23 In article <1991Apr25.213211.24114@asc.slb.com>, hargrove@asc.slb.com (Jim Hargrove) writes... [long discussion of a specific example omitted. See original posting.] >AND, I think the technical superiority of the C++ implementation is >significant. It isn't so important when there are only 4 cases. But >what if there are 20 or so? Then the savings in memory and execution >may be really important. In this example (and most other cases) there is really no savings in either memory or execution time. The visible switch is replaced by invisible (compiler-generated) selection code which decides which class the object belongs to. The code in the case statements is in the methods for the individual classes. IMHO the important issue is ease of maintenance of the code. It's interesting to see that there are arguments for C, as well as for C++, on this issue. > > -- jwh Nick Jacobs