comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <nholsti@icon.fi>
Subject: Re: Record comparision ?
Date: 1998/06/05
Date: 1998-06-05T00:00:00+00:00	[thread overview]
Message-ID: <35781C98.D235F580@icon.fi> (raw)
In-Reply-To: 3576214E.E7814E6B@adca01.enet.dec.com


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.




  parent reply	other threads:[~1998-06-05  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-04  0:00 Record comparision ? Prateek S Fulzele
1998-06-03  0:00 ` Mark Fisher
1998-06-05  0:00 ` Niklas Holsti [this message]
1998-06-08  0:00 ` John English
replies disabled

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