From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1ff5003422436e4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-12 23:21:01 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Easily-Read C++? Date: 11 Oct 1994 18:37:02 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <37em0e$oh0@watnews1.watson.ibm.com> References: <3719k1$11gt@watnews1.watson.ibm.com> <85C92963672@annwfn.com> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-10-11T18:37:02+00:00 List-Id: In article <85C92963672@annwfn.com>, merlin@annwfn.com (Fred McCall) writes: |> In <3719k1$11gt@watnews1.watson.ibm.com> ncohen@watson.ibm.com Norman H. Cohen writes: ... |> > |> >A more substantive objection to C++ is the fragility of programs written |> >in the language. Over and over again in the Annotated C++ Reference |> >Manual we see the phrase "You are warned," as if that shifts all |> >responsibility for an error-prone construct from the language designer to |> >the programmer who falls into the trap that has been set for him. |> |> Well, that's no worse than needing a copy of the Standard to be able to |> figure out what the hell Ada should be doing in a given situation. 1. It IS worse. The C++ rule makes it easy for a simple clerical error to corrupt the data structures of the run-time system. 2. The insinuation in this strange comparison is false. Every language has rules whose details have to be looked up now and then, but most of the time an Ada progammer does NOT "need a copy of the Standard to be able to figure out what the hell Ada should be doing in a given situation." |> >For example, the C++ type system (inherited from C) does not distinguish |> >between a pointer to an array of type T and a pointer to an individual |> >object of type T. |> |> Well, if you're not bright enough to keep the single fact in mind that |> arrays are not first class types in C (or C++), then you have a point. The problem is not in UNDERSTANDING that C does not distinguish between pointer-to-T and pointer-to-array-of-T, it is in coping with that language deficiency. The fact of the matter is that C++ allocators and delete statements DO distinguish between the two in their run-time behavior, so that a two-character clerical error has disastrous results; but the C/C++ type system does NOT distinguish between the two at compile time, so this error cannot, in general, be caught by the compiler. |> You should seek a safer language. Ada is not going to be safe enough |> for you, either. I'd suggest something using rubber letters. Programming with the Goodyear blimp is overkill. Type-safe deallocation, as provided in Ada by strongly-typed instantiations of Unchecked_Deallocation, is quite sufficient, thank you. -- Norman H. Cohen ncohen@watson.ibm.com