comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
To: "comp.lang.ada mail to news gateway" <comp.lang.ada@ada.eu.org>
Subject: Re: some simple questions
Date: Fri, 21 Feb 2003 20:15:56 -0600
Date: 2003-02-21T20:15:56-06:00	[thread overview]
Message-ID: <mailman.36.1045880089.9948.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: b36b5m$p0i$1@news.rz.uni-karlsruhe.de


----- Original Message -----
From: "Daniel Sch�le" <uval@rz.uni-karlsruhe.de>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: February 21, 2003 4:56 PM
Subject: some simple questions


> 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)
You need to instantiate Ada.Unchecked_Deallocation for the type integer.
Then you call the instantiated procedure to deallocate the memory.
See section 13.11.2 of the Ada Reference Manual.

>
> is there a syntax available to initialize allocated object (like in C++)?

Yes.  You would say
pi : pint := new Integer'(1234);

See sections 4.8 and 4.7 of the Ada Reference Manual.
> int * pi=new int(0);
> now I am doing that this way
> pi.all:=0;
>
> what is the proper way to assure that pointer points to valid object?
>
> and last one
> what's "std::system("clear");" translated to Ada
> (OS Linux)
>
> sorry if it's faq
>
> Thanks
>
> Daniel
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>





  reply	other threads:[~2003-02-22  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-21 22:56 some simple questions Daniel Sch�le
2003-02-22  2:15 ` David C. Hoos, Sr. [this message]
2003-02-22  6:29   ` tmoran
2003-02-22 11:22 ` Preben Randhol
2003-02-22 11:57 ` chris.danx
2003-02-22 16:15 ` Steve
2003-02-22 18:18   ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox