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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d5bcc1bc9c136ab7 X-Google-Attributes: gid103376,public From: Niklas Holsti Subject: Re: Record comparision ? Date: 1998/06/05 Message-ID: <35781C98.D235F580@icon.fi>#1/1 X-Deja-AN: 359880902 Content-Transfer-Encoding: 7bit References: <3576214E.E7814E6B@adca01.enet.dec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Telecom Finland News Service Newsgroups: comp.lang.ada Date: 1998-06-05T00:00:00+00:00 List-Id: Prateek S Fulzele wrote: > > Hi everybody! > > Here I have some doubts regarding record comparisions done in ADA. > > Read this code sample: > > type REC_TYPE; > type REC_PTR_TYPE is access REC_TYPE; > type REC_TYPE is > record > INT1 : INTEGER; > INT2 : INTEGER; > end record; > > -- now I declare two variables of REC_PTR_TYPE > REC_PTR1, REC_PTR2 : REC_PTR_TYPE; > > -- then, assign some values to the record members of > -- REC_PTR1, REC_PTR2. > .... > > -- now I say: > if REC_PTR1 < REC_PTR2 then > -- do so and so .. > end if; > > What is this signify ? The ordering operators "<" etc. are not predefined for access types such as REC_PTR_TYPE (nor for record types such as REC_TYPE), therefore the above has no significance in Ada and any Ada compiler should reject it with an error message. If you want to, you can define "<" for REC_PTR_TYPE or REC_TYPE to have any meaning you like, by writing your own function with the profile function "<" (Left, Right: REC_PTR_TYPE) return boolean or using REC_TYPE, respectively.