"Daniel Sch�le" wrote in message news:b36b5m$p0i$1@news.rz.uni-karlsruhe.de... > Hi all > > I am learning Ada on doing > I have found some small examples on web and > now I'm trying to put the mosaic stones together > > my questions are > > given > type pint is access integer; > pi: pint:=new integer; > > how do I delete the allocated object? > free(pi); --doesn't work > (I'm pretty sure Ada doesn't have Garabge Collector) > > is there a syntax available to initialize allocated object (like in C++)? > int * pi=new int(0); > now I am doing that this way > pi.all:=0; > If you add: procedure free is new ada.unchecked_deallocation( integer, pint ); Then free(pi) works. Since Ada is a type-safe language, you can't use the same function on any old type of variable. Generics are a way of creating generic functions and procedures where you can specify a specific type by creating an instance of the function or procedure. The standard library for Ada includes a generic procedure for deallocating memory. You create an instance of the deallocator for your specifc type as shown above. Since you're new to Ada, I suggest perusing the standard library of functions which you'll find at: http://www.adaic.org/standards/95lrm/html/RM-A.html The reference manual isn't very good for learning Ada, but it is a good reference for the functions in the standard library. You will find a number of books on Ada at: http://www.adapower.com/books/ > what is the proper way to assure that pointer points to valid object? When you declare an access variable in Ada, it is set to null by default. Usually you can test for a valid pointer by testing for null. > and last one > what's "std::system("clear");" translated to Ada > (OS Linux) > I can only guess on this one (you'll probably get an answer from someone else). Here's my guess: If the profile for system looks something like: int system( char *str ); Then in Ada you can use that function by declaring: function System( str : Interfaces.C.Strings.Char_Array_Access ) return integer; pragma Import( C, System, "system" ); And then treating the function just as you would any other Ada function. One of Ada's strong points is interfacing with other languages. I hope this helps, Steve (The Duck) > sorry if it's faq > > Thanks > > Daniel > >