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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: "James A. Squire" Subject: Re: C is 'better' than Ada because... Date: 1996/07/17 Message-ID: <31ECF6C6.379B@csehp3.mdc.com>#1/1 X-Deja-AN: 168607853 sender: Ada programming language references: comments: Gated by NETNEWS@AUVM.AMERICAN.EDU content-type: text/plain; charset=us-ascii organization: MDA Avionics Tools & Processes mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (X11; I; HP-UX A.09.01 9000/715) Date: 1996-07-17T00:00:00+00:00 List-Id: Nasser Abbasi wrote: > What about the inability to specify input-only scalar parameters (or > can you declare a parameter to be "const" now?)? > > I am not sure I understand this. Do you mean like doing enumeration IO > in Ada ? No. I was confused. I withdraw that one. I was thinking of something else. Actually, it smells like there is a hole there somewhere, since in C the caller has some control over specifying what we in Ada call the "mode" of the conceptual parameter (via the & operator), whereas in Ada this is completely specified by the callee. What I thought of was the warning they give in a Motif training class about the following kind of code: n = 0; XtSetArg(arglist[n++], XmNx, 500); XtSetArg(arglist[n++}, XmNy, 200); XtSetValues(widget, arglist, n); They said this was a no-no because n gets incremented twice on each XtSetArg. What I completely forgot is that XtSetArg is a macro, not a function. Sorry.... > > What about the lack of any boundary checking at all? > ^^^^^^^^^^^^^^^^^^^^^^^^^ > What about runaway pointers? > > But runaway pointers is what makes C/C++ programming so much > more challenging :) > > James make good points ofccourse, but I think the view that C++ > programmers would have is that some of the above could be fixed > by using classes instead of the primitive language data types. At least Could be. I'm not familiar with C++ yet. Of course, C++ doesn't prevent you from falling back on the old C way of doing things, and C was the language being compared to Ada. My point was that these are things you literally cannot do even if you wanted in Ada, or as is the case (I now realize) with boundary checking, at least in Ada you have to go out of your way to open things up (pragma suppress) whereas in C you have to go out of your way to shut things down. As you point out, in Ada boundary checking is built in to the language, which means you have to explicitly turn it off, or else you will get compilation errors or constraint errors. In C++ you would have to implement it yourself and then promise to use only that which you created to do things, or else you can violate boundaries without complaint. We're pretty much in agreement. I just wanted to further clarify my point. Thank you in any event for the support. -- James Squire MDA Avionics Tools & Processes ja_squire@csehp3.mdc.com Opinions expressed here are my own and NOT my company's "one of these days I'm going to better myself by going to Knight school" "You'll be a web knight instead of a web page!"