address representation in ada
        Posted  
        
            by maddy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by maddy
        
        
        
        Published on 2010-04-27T09:31:54Z
        Indexed on 
            2010/04/27
            9:33 UTC
        
        
        Read the original article
        Hit count: 509
        
Hi all,
    I have pasted a code below which is in ada language.I need some clarification on some implementations.
               C  : character;
Char : character; type Myarr_Type is array (character range 'A'..'K') of character; Myarr : Myarr_Type := ('A','B','C','D','E','F','G','H','I','J','K');
   Next_Address := Myarr'address
   Last_Address := Next_Address + Storage_Offset'(40);
    my_func(int P1,int P2)
   {
          return P2 + Storage_Offset'(4);
   } 
Last_Address := Next_Address + Storage_Offset'(4);
Now my doubt is 1)what does P2 + Storage_Offset'(4) actually mean.Does that mean that its returning the address of the next element in the array which is 'B'.Storage_Offset'(4) in ada --does this mean 4 bits or 4 bytes of memory. 2) If i assume that Last_Address points to last element of the array which is 'K',how does the arithmentic Storage_Offset'(40) satisfies the actual implementation?
      Please get back to me if u need any more clarifications.
      Thanks
      Maddy
        © Stack Overflow or respective owner