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,f2690a5e963b61b6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Wed, 06 Jul 2005 22:14:37 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> <1120575076.876798.108220@g44g2000cwa.googlegroups.com> <1120583470.429264.325450@g43g2000cwa.googlegroups.com> Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: Wed, 6 Jul 2005 22:17:45 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-kNzufJ6QJ6R7jwoiH7zNZZAn87MQOF1CyG+Kw0pueGVPI4dLFTqsXwmIGK5rP4lfeT953k7B9Z0oXke!SbHfWgtqp7dGfZelaLq1L+PqlGp+a8Rvx/3I53E+MJeMKIPyq8cDL8jbXYfOCIQ82iaVMmroAXwX 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.3.32 Xref: g2news1.google.com comp.lang.ada:11919 Date: 2005-07-06T22:17:45-05:00 List-Id: "Matthew Heaney" wrote in message news:uslyrv50w.fsf@earthlink.net... ... > I had originally included checks that didn't require any extra storage > overhead, controlled by the use of pragma Assert. However, it turns out > that even if you compile with assertion checks on, whether assertions > are enabled is decided at the time of compilation of the generic. And > in the GNAT runtime, all checks (including constraint checks -- gulp! > I'm still fixing that...) are turned off. I wanted additional checks to > be controlled by the user (at the point of instantiation), but I still > haven't figured out how to do that. Yuck. I agree that being able to control the checking somehow would be a good thing. That probably will require some cooperation with the compiler vendor, so it is up to the users to put the pressure on the vendors. Using Assert to do that seems like a good idea. (But it wouldn't have any effect on our code-shared implementation of generics, for the obvious reason.) > To make things absolutely bullet-proof, I think you'd need at least a > per-element reference count. (That, or have the container maintain a > list of extant cursors, which you would then have to search.) If you > attempt to delete a node for which the ref count is greater than 0, then > you could raise an exception. (This might actually produce a false > positive, since the real error is attempting to dereference the cursor, > not merely delete the node to which it is bound. But to solve that, > you'd have to move the node onto a free list, and during the dereference > check to see whether the node is on the free list or not.) Yes, and I agree that is too much overhead. I'm planning to use a serial number scheme. It won't detect every possible error (if the memory for the element or container as a whole is reused, there would be a very small chance that it would fail to detect an error), but it would catch the vast majority of them. > So yes, there are some extra checks that can be performed, but I still > prefer to let the user control whether they're enabled. > > You are also correct about immaturity of implementations. I'm still > developing a set of unit tests for the containers. (In fact, I found a > bug this morning in the Merge operation of the list container.) So > there's still lots of work to do, especially with the post-York API > coming down the pipe... That's one of the things (other than pure lack of time) that's kept me from starting an implementation. Some ACATS-style tests would be very welcome. Randy.