Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: GCC 4.0 Ada.Containers Cursor danger.

charles
Discussion topic

Back to topic list

Re: GCC 4.0 Ada.Containers Cursor danger.

Reply

Author Georg Bauhaus <bauhaus at arcor dot de>
Full name Georg Bauhaus <bauhaus at arcor dot de>
Date 2005-07-04 11:56:50 PDT
Message 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/a​da/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

« Previous message in topic | 1 of 3 | Next message in topic »

Messages

Show all messages in topic

Re: GCC 4.0 Ada.Containers Cursor danger. Georg Bauhaus <bauhaus at arcor dot de> Georg Bauhaus <bauhaus at arcor dot de> 2005-07-04 11:56:50 PDT
     Re: GCC 4.0 Ada.Containers Cursor danger. Georg Bauhaus <bauhaus at futureapps dot de> Georg Bauhaus <bauhaus at futureapps dot de> 2005-07-04 12:03:05 PDT
     Re: GCC 4.0 Ada.Containers Cursor danger. Matthew Heaney <mheaney at on2 dot com> Matthew Heaney <mheaney at on2 dot com> 2005-07-05 07:26:54 PDT
Messages per page: