comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Printing the address
Date: Tue, 11 May 2021 15:41:16 +0300	[thread overview]
Message-ID: <ifvcbdFckevU1@mid.individual.net> (raw)
In-Reply-To: <609a5eaf$0$20558$e4fe514c@news.kpn.nl>

On 2021-05-11 13:38, ldries46 wrote:
> I Get an contstraint error in the line:
> /if Boxes(n).Status = manual or Boxes(n).Status = auto then/


That is either becase "n" is not in Boxes'Range, or because Boxes(n) is 
null. From the rest of your message, it seems you believe that the 
latter is the cause.

(Btw, a briefer expression is

    if Boxes(n).Status in manual | auto then ...

assuming that Box_Status is a discrete type.)


> where/:
>     Boxes     : Ar_Box;
>     type Box is record
>        Status  : Box_Status;
>        Nrs_pos : Ar_Pos;
>        x_val   : integer;
>        y_val   : integer;
>        Fill    : integer;
>     end record;
> ///   type Box_Acces is access all Box;
> /   type Ar_Box is array (1 .. Max_Num) of Box_Acces;
> 
> /To debug the program I need to finf where the constraint is
> possible a 0x0 somewhere in Box


I assume you mean that some element of Boxes is a null access. That may 
or may not be represented as 16#0#.


> How can I priint this value I tried converting it to and integer but I 
> couldn'd get that working


You don't have to print the value. All that should matter to you is 
whether the value is null or not, so:

    Put (if Boxes(n) = null then "null" else "not null");

(If you really want to print the address, do

    System.Storage_Elements.Integer_Address'Image (
       System.Storage_Elements.To_Integer (Boxes(n).all'Address))

but be sure to check for a null value of Boxes(n) first.)

      parent reply	other threads:[~2021-05-11 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <609a5eaf$0$20558$e4fe514c@news.kpn.nl>
2021-05-11 12:35 ` Printing the address Maxim Reznik
2021-05-11 14:55   ` Niklas Holsti
2021-05-11 12:41 ` Niklas Holsti [this message]
replies disabled

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