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,1042f393323e22da X-Google-Attributes: gid103376,public From: "James S. Rogers" Subject: Re: Any research putting c above ada? Date: 1997/04/14 Message-ID: <33530E22.5940@worldnet.att.net>#1/1 X-Deja-AN: 234880133 References: <5ih6i9$oct$1@waldorf.csc.calpoly.edu> <5ijb0o$ajc@ns1.sw-eng.falls-church.va.us> <334d3da5.14386594@aplcen.apl.jhu.edu> <2senchydgk.fsf@hpodid2.eurocontrol.fr> <5im3an$3dv@bcrkh13.bnr.ca> <33526cbf.41c6@cca.rockwell.com> <5iusvd$118e@newssvr01-int.news.prodigy.com> Organization: AT&T WorldNet Services Newsgroups: comp.lang.ada Date: 1997-04-14T00:00:00+00:00 List-Id: Matthew Givens wrote: > > Roy Grimm wrote: > > > <<<<< SNIP >>>>> > > > >There is a subtle difference you are missing here. In Ada, any type > >_difference_ will cause a compile time error. In C, the type > >_incompatibilities_ are the only things to be caught. What is the > point > >of defining different types if you can freely assign between them? > >Different types are used for different purposes. Removing that > checking > >eliminates the structure that makes Ada so much easier to debug. > > > > Hmmmmm, the other side of that coin is that an integer is an integer, > whether it's called an integer or "timer" or whatever other name the > programmer selected for the new type. If both types can contain the same > data, then why shouldn't you be able to mix these types? It's a matter > of preferences. Some prefer a rigid, well-enforced environment, and > others prefer a looser one. Even in C it is not a good thing to assume an integer is an integer. A pointer value is an integer. No experienced C programmer would multiply a vote count with a pointer value, assigning the result to the pointer. Speaking of pointers as integers, what about that special pointer value 0? Why are there no negative pointer values? After all, an integer is an integer. Why is there a difference in the C specification between characters and longs? Certainly they are both forms of integers in C. They must, by your logic, be completely inter-convertable. Why does C++ not allow the implicit conversion between enum types and int which is allowed in C? The reason is that such a conversion will easily and quickly lead to undefined results for the enum type. Such undefined results cannot be easily caught by a C compiler. Even lint is of little use in detecting this error. Of course there are different types which use any integer-like representation. That does not make the types even approximately compatible. Incompatible types should not be masked by using one single integer representation for all of them. Strong typing as found in Ada can be difficult to deal with. It can be difficult because it forces the designer to understand the behavior and limitations of the design in great detail. Weak typing allows the designer to ignore many behavior and limitation details. When design ignores behavior and limitation details the door is opened for catastrophic failure. It is usually very difficult to detect these problems in formal testing, leaving major defects in the delivered product code. Such defects are more and more frequently exposing software developers to serious legal actions including criminal charges and civil suits. Jim Rogers Colorado Springs, Colorado -------------------------- Team Ada