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-Thread: 103376,a88e582de42cdc9b X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Bug in Ada (SuSe 10.2) ? Date: Fri, 22 Feb 2008 13:52:11 -0600 Organization: Jacob's private Usenet server Message-ID: References: <0_mdna0iHpIsCifaRVnzvQA@telenor.com> <47ba9867$0$21892$4f793bc4@news.tdc.fi> <3a281192-2744-4110-9fc1-90c155c9436b@d4g2000prg.googlegroups.com> <48277611-402f-4622-be05-6edddf6dd56a@o10g2000hsf.googlegroups.com> <624tcvF21i3nvU1@mid.individual.net> <2630d99b-1578-4d79-ac9c-64c00c203b77@e60g2000hsh.googlegroups.com> <69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1203715060 26955 69.95.181.76 (22 Feb 2008 21:17:40 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 22 Feb 2008 21:17:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:19994 Date: 2008-02-22T13:52:11-06:00 List-Id: wrote in message news:69019a65-736e-48ee-bd9f-4c29cd7fc88f@72g2000hsu.googlegroups.com... >On Feb 21, 2:32 pm, "Randy Brukardt" wrote: >> We're talking about language-defined checks. There are no language-defined >> checks for dangling pointers! > >Huh? >In Ada83 there was no provision for pointers into the stack, because >of the well-known danger of leaving a dangling pointer when the >subprogram exited. Ada95 considered it necessary to allow pointers >into the stack, in part because users were doing it anyway (using >unsafe techniques like 'address and Unchecked_Conversion) to avoid >the well-known dangers of using heap allocation. > >To eliminate the danger of dangling pointers into the stack, Ada95 >introduced the concept of Accessibility_Check, which, like >Overflow_Check, can be controlled using pragma Suppress/Unsuppress, >and possibly compiler switches. These aren't "dangling pointer" checks (which would occur on the dereference). If you wanted to talk about them informally, I'd call them "lifetime" checks, but it is best to call them by their real name (which you finally did above). I thought you were talking about something completely different. Anyway, accessibility checks contain both a static and dynamic part, and it is fairly difficult to write an interesting program that passes the static check and fails the dynamic check. The most likely way to do so in practice is to use an anonymous access parameter -- and this is the best reason for avoiding such parameters, as you have the possibility of failure just because you are making a call from a nested location. And, yes, I suppose you could suppress the check. You could also play Russian Roulette. Or, most likely, you'll have used 'Unchecked_Access to avoid that silly check in the first place (it prevents lots of things that are safe to do). But you still would have been better off avoiding the unchecked access in the first place, because eliminating the check would not eliminate most of the overhead (that overhead can only be eliminated if the subprogram body and all calls are compiled such that it is certain that the check is suppressed and cannot be turned back on -- which means that any separate compilation eliminates that possibility). In any case, there is nothing wrong with having the ability to suppress language-defined checks via a compiler switch or whatever. But there is something wrong with having the default operation of a compiler having those checks suppressed. Yes, pendantically this is OK, but it means that new users don't actually use the Ada standard mode. Randy. Of course, the danger is only eliminated when this language-defined check is fully implemented in standard mode.