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/11 Message-ID: <31E57A6C.3F2E@csehp3.mdc.com>#1/1 X-Deja-AN: 167993562 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-11T00:00:00+00:00 List-Id: Mike Roske wrote: > > What is considered C's greatest asset is also its greatest failing for > > developing large, robust systems: it assumes that you, the programmer, > > know what you are doing at all times. That's a bad assumption to make > > for a lot of us (me included). > > I have to disagree a little bit here. I don't believe Ada FORCES you to > write good, clean, safe code. It just makes certain bad things more > difficult to accomplish. I see no disagreement between this statement and the one it is responding to, not even a little bit. No one SAID Ada FORCES you to write good, clean, safe code. > Having had the experience of guiding (shepherding? ;-) ) several 'C' code > writers into writing more structured software, I can tell you that it is just as > easy to write bad, dirty, dangerous code in Ada. And this statement of yours contradicts the above statement of yours, where you said, "It (Ada) just makes certain bad things more difficult to accomplish." If you are attempting (by using words like "certain bad things") to minimize this, you have a long way to go to make your case. It is not at all obvious that in a strongly typed language such as Ada it is "just as easy to write bad" code as it is in not-strongly typed language like C. Strong-typing alone means less opportunities to screw up. And that's just one area. What about piggy-backing case parts of switch statements because someone forgot to put in the "break;" statements? What about the lack of bounded enumeration types, especially the crucial Boolean type and the corresponding "!=0" default boolean condition, which kicks in because you forgot to specify "==" instead of "="? What about the inability to specify input-only scalar parameters (or can you declare a parameter to be "const" now?)? What about the lack of any boundary checking at all? What about runaway pointers? These and probably a number of other flaws the Ada language simply does not have. I do not include leaving garbage collection up the user which both Ada83 and C have (though Ada95 does improve upon this with Ada.Finalization). Furthermore, both Ada83 and Ada95 still have goto's, so that too is a wash. You might be tempted to bring up the "use" clause. Think again. C operates with a default "use" clause on everything. Where the Ada programmer has to explicitly put in a use clause for each desired package in order to secretly use anything in those packages (which he blindly and erroneously assumes is an iron-clad guarantee), the C programmer has to explicitly use the word "static" in a module to prevent any other module from "extern"-ing the given data object. As much trouble as "use" causes in Ada, it's still better than what C has. All you have shown is that in Ada it is still POSSIBLE to write bad code. Bravo. Take two opaque pointers out of petty cash. -- 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!"