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,FREEMAIL_FROM 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!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail Message-ID: <42C98672.3020705@arcor.de> Date: Mon, 04 Jul 2005 20:56:50 +0200 From: Georg Bauhaus Organization: VoCal web User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> In-Reply-To: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Date: 04 Jul 2005 20:56:48 MEST NNTP-Posting-Host: 2e477e86.newsread2.arcor-online.net X-Trace: DXC=3UPmm[`VOS:g0XoR1BOW]NnY[\SNbC78UUng9_FXZ=3>:=P9Ihe`B8@Z?dZ]MOid5 X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:11853 Date: 2005-07-04T20:56:48+02:00 List-Id: Dmitriy Anisimkov wrote: > IMHO the cursors in the Ada.Containers implemented in GCC 4.0 > dangerouse like pointers in C/C++. I think saying that Cursors are as dangerous as Ada pointers is more to the point. IIRC there are significant differences between Ada.Containers and STL, more checks i.e. Not sure though why Replace_Element doesn't raise an exception, possibly because messing around with two pointers to the same object and then deleting the object can lead to erroneous execution: "Erroneous Execution "A Cursor value is *invalid* if any of the following have occurred since it was created: ... * The node it designates has been deleted from the map." Why are you using two different cursors (pointers), then delete their element (set the pointee to null) using one, and then expect the other cursor (pointer) to be designating some object still? (I guess you don't but expect this the example is made up to convey this impression.) > valgrind showing the memory corruption > --------------------------- > I am using "ADT Components" from > http://lgl.epfl.ch/ada/components/index.html too. > I think that ADT is much more on the Ada way then proposed > Ada.Containers with cursors. Should access types not be in Ada? At what cost? Cc: charles users list at tigris Georg