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!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> <1121573057.159416.274980@g49g2000cwa.googlegroups.com> <1121620423.900805.215150@g43g2000cwa.googlegroups.com> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 17 Jul 2005 17:36:12 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1121621772 24.149.57.125 (Sun, 17 Jul 2005 10:36:12 PDT) NNTP-Posting-Date: Sun, 17 Jul 2005 10:36:12 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:3649 Date: 2005-07-17T17:36:12+00:00 List-Id: "Dmitriy Anisimkov" writes: > << > >No, this checking is too much overhead. > Too much overhead, compared to what? > >> > > Ok. I thought that you told about checking in > pragma Assert (not Has_Element (C2)); > pragma Assert (not M.Contains ("two")); No, I was referring to the checking in the implementation of the map container itself. The checks above are part of the example, and exist for informational purposes only. > if you told about new checking inside of > > Replace_Element (C, -2); -- dangling cursor > > it is not "too much". Yes, that's the checking to which I was referring. I'm glad to hear you don't think it's too much. (However, to check for dangling cursors, you'll have to enable assertion checks when you compile.) Did you try compiling your original example with assertions enabled? What happens when you do? (I have been modifying the GCC sources to be more thorough in my use of assertion checks and cursor vetting, but you still have an older version. If you're having an emergency, I can update the sources at tigris too, so you can have the improved checking right away.) > << This is a false analogy, since the name of the operations are > To_Pointer > and To_Address. Nary an "unchecked" in site... >> > > Isn't To_Pointer equivalent to Unchecked_Conversion from Address to > Access ? Yes, but since these conversions are provided by the language, they're not outside the type system anymore, and hence don't require any scary "unchecked" names. "Unchecked" conversions imply that you're leaving the type system, and that's never the case for the containers.