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,5117b1b6391a0e06 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 29 Jun 2004 13:35:43 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1087410710.477506@master.nyc.kbcfp.com> <1087474761.60413@master.nyc.kbcfp.com> <7o83d0hf6sqgng2980e1tg7iu864m5m50u@4ax.com> <1in5d05aa4rfqlt7e76gk87ucd3vuru6pm@4ax.com> <1087564576.388973@master.nyc.kbcfp.com> <1087575262.304708@master.nyc.kbcfp.com> <2i5dd0lu0i3a8bokfh7916r4j67g42ri4o@4ax.com> Subject: Re: A simple ADA puzzle (I haven't the answer) Date: Tue, 29 Jun 2004 13:36:07 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-iz79h2FQLcIxeTz5sLhX81ol2tC7SATlufpFqRbL6LpWBIXTW2GM3mfeTlGcEc7eRW8CB1fxBWvGd/f!HSdnur27hqXOcaJ2vRDgJajjbgxix5brdb/2M58hTKD3fDjXr2zVr3KQ7MO7EqpIdWWcWam5Rs79 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:2001 Date: 2004-06-29T13:36:07-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:lmxpjfq0f1wq$.58zpkhc78ocd.dlg@40tude.net... > On Mon, 28 Jun 2004 19:08:04 -0500, Randy Brukardt wrote: .. > > I don't follow. It's going to be just as necessary, because the usual use is > > to use it inside of a subprogram to put an object on a global chain. Even if > > the object is known to be global, or finalization cleans up properly (as in > > Claw), it still fails the accessibility check. > > > > Similarly, the creation of dangling pointers isn't new. And it could hardly > > get more dangerous than dereferencing a dangling pointer and writing over > > someone else's memory - which can happen with any dangling pointer. > > New is creation of dangling pointers in/to a dispatching table. Provided > that no tag checks are made. So what? That's no worse than anything else that can happen for a dangling pointer. Besides, such dispatch tables can only exist in objects which themselves are out of scope and have been finalized. (The objects always go away before the type. That's why you're not allowed to allocate such a nested type for a outer access type. Neither 'Unchecked_Access nor Unchecked_Conversion can change the owner of an object.) So the dangling pointer is the one at the object; the dispatch table is just another part of the invalid contents. Thus, there is no reason to treat these specially; nothing worse can happen than can happen with any other dangling pointer. *Any* dangling pointer can access or overwrite memory that it doesn't own. And code never disappears, so there is no problem actually making a call. I've had to debug programs that dispatched thru dangling pointers in Ada 95, and it isn't pretty (usually, you end up jumping to some random location, often several times before trapping). A dangling dispatch table would be a lot easier to deal with, because it would actually be executing code (as opposed to random junk). Randy.