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!news2.volia.net!news2.dg.net.ua!news.alkar.net!not-for-mail From: Maxim Reznik Newsgroups: comp.lang.ada Subject: Re: GCC 4.0 Ada.Containers Cursor danger. Date: Wed, 06 Jul 2005 12:10:11 +0300 Organization: Alkar Teleport News Server Message-ID: References: <1120474891.635131.216700@g44g2000cwa.googlegroups.com> <42C98672.3020705@arcor.de> NNTP-Posting-Host: 213.154.193.74 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: pandora.alkar.net 1120641011 45459 213.154.193.74 (6 Jul 2005 09:10:11 GMT) X-Complaints-To: abuse@alkar.net NNTP-Posting-Date: Wed, 6 Jul 2005 09:10:11 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050402 X-Accept-Language: ru, en-us, en In-Reply-To: <42C98672.3020705@arcor.de> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Xref: g2news1.google.com comp.lang.ada:11887 Date: 2005-07-06T12:10:11+03:00 List-Id: Georg Bauhaus wrote: > Dmitriy Anisimkov wrote: > >> IMHO the cursors in the Ada.Containers implemented in GCC 4.0 >> dangerouse like pointers in C/C++. > I agree with Dmitry such behavior of Cursors is very dangerous and should be avoided. > > "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 dont request to set such invalid cursor to No_Element to avoid dangling references? If container knows all his cursors it can do it easy. There are a very few cursors per container in typical program, so it is not big work. And safety here is much important then performacne. > >> valgrind showing the memory corruption >> --------------------------- Using such hard tool to debug operations with containers is certainly be avoided. -- Maxim Reznik http://www.ada-ru.org/