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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e3a48fe2095ca715,start X-Google-Attributes: gid103376,public From: Mats Weber Subject: Re: ADA 95 Questions. Date: 1998/06/18 Message-ID: <35892484.9514B8E@elca-matrix.ch>#1/1 X-Deja-AN: 363862150 Content-Transfer-Encoding: 7bit References: <35890E1B.2A19914F@tech.swh.lv> Mime-Version: 1.0 Reply-To: Mats.Weber@elca-matrix.ch Content-Type: text/plain; charset=us-ascii Organization: ELCA Matrix SA Newsgroups: comp.lang.ada Date: 1998-06-18T00:00:00+00:00 List-Id: Maxim Senin wrote: > > Hi all! > > I have some ADA questions: > > * Is ADA garbage collector? Ada allows a garbage collector, but does not require it. I think there is currently no Ada implementation that provides garbage collection. Note that controlled types eliminate much of the need for GC. > * Can I do something like in C++?: > int[] array = new int [100]; type Int_Array is array (Positive range <>) of Int; type Int_Array_Access is access Int_Array; X : Int_Array_Access := new Int_Array(1 .. 100); > How can I dinamically allocate array? see above. > How to copy array elements? I mean, can I copy part of array as > it is fo strings in this manner: > s1 : String := "Hello"; > s2 : String := "World!"; > begin > s1 (1..4) := s2 (2..5); -- will result s1 = "orllo" > end The code is correct, but the reesult will be s1 = "orldo". > or like Java's System.arraycopy() routine? > * What's the difference between A, A'Class and A'Access? (Seems > A'Access is similar to C's &A)? A'Class is not an access type. It is an indefinite type that can hold a value of A or any of A's subclasses (i.e. any type derived directly of indirectly from A). A'Access denotes a pointer to the object A. A'Access does not mean anything when A is a type. I would recommend reading about this in a book (not the RM, it's too hard to read when leaning the language). > * What's the difference between following procedure defs: > procedure p (a : C); the parameter must be of type C. > procedure p (a : C'Class); the parameter must be C or any type derived from C (if C is tagged). > procedure p (a : C'Access); does not compile. > procedure p (a : access C); the parameter must be a pointer to an object of type C. > procedure p (a : in out C); ? the parameter can be both read and written, as opposed to the other cases above (except access). > * What means procedure/function parameter without "in/out" > specifier (e.g. procedure p (a : Integer; b : in Boolean; c : out > Float; d : in out Double))? if there is no mode specified, then the mode is in.