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,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-12 17:37:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!news-out.nuthinbutnews.com!propagator2-sterling!news-in.nuthinbutnews.com!usc.edu!rpi!not-for-mail From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 12 Jun 2003 20:39:38 -0400 Organization: LJK Software Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 12 Jun 2003 10:16:10 -0500 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPukdRkHMCo9UcraBAQGgzgH+JElDzEHwyudqUy0ryb5iYu0VTmbTAX3c qRCz7M9zdknB2oFof+vAKOHUyOOkXfe9ZzBwr/QFkcgv2SYNfRsakg== =+nXI Xref: archiver1.google.com comp.lang.ada:39071 comp.lang.c++.moderated:68245 Date: 2003-06-12T20:39:38-04:00 List-Id: In article , kanze@gabi-soft.fr writes: > James Rogers wrote in message > news:... >> Since this was cross-posted to comp.lang.ada I think it is fair to >> mention that there is a language that meets your description above. >> That language is Ada. > > Permit me to be sceptical. If your claim is that Ada has more of the > safe defaults than C++, I doubt anyone would dare argue it. If your > claim is even that most of the defaults are the safe version, from what > little I know of the language, it would seem true. But to say that in > 1983, they got everything right, including problems that weren't even > understood until significantly later. Well, I'm sceptical. Perfection > just isn't of this world. > > One point where I'm pretty sure Ada 83 didn't have the right default > (although they may have fixed it in Ada 95): garbage collection. While > there are places where it is necessary to turn garbage collection off > (which seriously limits the use of a language in which you cannot have > untraced pointers, which the garbage collector cannot see), the safe > option is obviously to have it on by default, no? Perhaps it depends on what one means by the word "safe" :-), but even with Ada 95 provision of any garbage collection is up to the compiler vendor. Since the language definition does not mandate garbage collection, it cannot very well mandate that it be defaulted on or defaulted off. Does the C++ standard mandate garbage collection be on or off ? > Seriously, I am aware that 1) Ada generally adopts the safe option, and > 2) you can generally "work around" the safety checks if necessary > (hopefully on a case by case basis, using source code constructs; > e.g. by writing array.unsafe_at( index ) rather than array[ index ]). > In my original statement, I'll admit that I wasn't thinking so much > about Ada, as about some other, more popular languages which claim a lot > of safety that they don't necessarily give. Still, even thinking about > Ada, I don't think I'd change it. As I say, I simply cannot believe > that the language is perfect. I don't think anyone in comp.lang.ada believes Ada is perfect either. The typical Ada expert believes in code review, formal inspection, fault analysis, project specification and many other activities that would be useless if there were a perfect programming language. > I would certainly not claim that the defaults for C++ are safer than for > Java. I've been using C++ now for close to fifteen years, and almost > exclusively for ten (except for a short excursion into Java). Certain > avoidance manoevers have become instinctive, but I know that they are > missing in 99% of the code I see. I suspect that I would need a lot > less avoidance manoeuvres in Ada -- perhaps none in day to day coding. > But I really doubt that there would never be a case where I couldn't do > better than the default. Sometimes "better" is subjective, but if a compiler can be told to include or omit those checks it is easier to try it both ways to see if omitting checks really has an effect on performance. [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]