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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,df854b5838c3e14 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,df854b5838c3e14 X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,df854b5838c3e14 X-Google-Attributes: gid109fba,public From: nelsoni@rintintin.Colorado.EDU (Ian S. Nelson) Subject: Re: C/C++ knocks the crap out of Ada Date: 1996/02/19 Message-ID: X-Deja-AN: 139999024 references: <00001a73+00002504@msn.com> <3114d8fb.5a455349@zesi.ruhr.de> <4f5h5t$f13@vixen.cso.uiuc.edu> <4g1bgf$l5@mailhub.scitec.com.au> <4g2vn3$rgi@dfw.dfw.net> <4g8ook$bce@mailhub.scitec.com.au> organization: University of Colorado at Boulder newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-02-19T00:00:00+00:00 List-Id: ramsesy@rd.scitec.com.au (Ramses Youhana) writes: >David Weller (dweller@dfw.net) wrote: >> In article <4g1bgf$l5@mailhub.scitec.com.au>, >> Ramses Youhana wrote: >> >Another thing not mentioned is that Ada is far more complicated to learn >> >fully than is C/C++. The complexity of the language can add to an increase >> >in the probabilty of bugs being introduced and also adds to an increase in >> >project maintanace costs. >> > >> Compared to C++? You are wrong. There are fewer features in C++, yet >> the (draft) reference manual is larger than Ada 95 (not that this is >> necessarily a good measure, but rather that a language that is less >> complex would hopefully require less "langauge" to specify it). My >> personal experience with Ada 95 and C++ indicates the exact opposite >> of your conclusion. I have a feeling you haven't used Ada 95 very >> much to make such claims. >Sorry. I had once heard that Ada was more complicated than C. However, as >many people have posted and told me otherwise, I take the comment back. >However, I am interested in knowing what the advantages and disadvantages C/C++ >and Ada (or Ada 95) languages have over each other, without having to buy a >book on Ada (as I am unlikely to use it in my profession), especially for >engineering applications. I'm not an Ada ninja or anything, I've done a fair bit of coding in it though. I've done a heap of coding in C++, I've been hacking around with it since around 1990. I'll try to start it off though... (and if you are an engineer then there is a decent chance that you might end up using Ada, it depends on who you work for though.) These are all religious issues to a lot of people. It is possible, IMO, to write good C++ and to write crappy Ada. For imparitive programming and in general: * C++ is not strong typed. You can point a string to an integer to a float and the most you'll usually get is a compiler warning. C coders can use that ability to do neat things but in terms of language design, I think it is more desirable to only allow those kinds of conversions if you mean it. Bad things can happen. * C++ functions can be anywhere. On more than one occasion I have had to result to using "grep" on a large directory of files because a programmer decided to just throw it in to a file for no obvious reason. Ada coaxs programmers to put things together a little more. * Ada makes it more clear on what parameters for functions (procedures and functions) do and what happens to them. It is not uncommon to send a pointer to a function in C++ even though the function doesn't change anything. * Here is a good religious issue: C and C++ pick lousy names for the standard library functions and classes. * Ada is case insensitive. C and C++ both care about the case you use. * There are stylistic differences. I can't think of a good way to describe them. When you design a big C++ program you do it differently than you do with Ada. Surely someone else can explain this more. C++ code is structured into files, Ada is in packages, they are just different in some holistic way. * C++ templates and exceptions are a pretty new standard for the language, until recently the compiler vendor decided how to handle them. They aren't really in wide use yet. * C++ won't let you range types: a la "type year is an integer from -2000 to 2050" or like that. * C++ enums are still typically just integers, is this changing? * C and C++ have macros, I don't think ada has a feature like that. * I'm not sure if this is a compiler feature or an Ada feature, but Ada pays more attention to header files when compiling. With C++ you can change one header file and it won't recompile your source files unless you tell it to in your makefile. I think Ada will notice those changes. * There is probably a larger amount of C and C++ code open to the public that you can draw from. * There are more C and C++ compilers. * There are more C and C++ books. * There is a certification process for Ada compilers, you take the vendor's word for it in the C++ world. add more if you think they are relevent. Please correct me if I messed something up, today has been an overly productive code day and I'm drained. For objects: Now this section is much more religious, that's just the nature of OOP... * Ada doesn't have multiple inheritance, at least I don't think it does. This is subjective, there are ways around it and many people think it is "dangerous." I kind of like to have it as an option though, if my object model demands that an object has to superclasses then I want it. More importantly, if my boss gives me an object model with a class that has two parents then I want it. * It's my opinion that Ada is more likely to bark at you if you forget to include a method. I've written code that has outputed pointer addresses to the screen because I didn't supply a method and then I just threw in a cast because it gave me a warning. * Here is another really religious issue. When I get really tired and I'm doing C++, I resort to doing stupid tricks to make things compile (I hate leaving code broken overnight) when I get a compiler error I, in advertantly, do something stupid to "fix" it. When I get a clean ada compile, I feel better about the code. When I get a clean C++ compile I question my test methodology. You can always force C++ to compile even if it does something really stupid. * Ada seems tobe easier to do large projects in. In C++, it has been my experience that work gets divided up between coders by class. (eg: Bob, you do the string class. Bill, you do the LZW class. Sarah, you do the tree class... etc.) * I think I like the emacs mode for ada more than the C++ mode that I have. surely there is a lot more to be said about this. I'm starting to have a lot of trouble typing so I'm going to stop now. Ian >Ramses.