From: arne@vajhoej.dk   
      
   On 11/17/2025 3:33 PM, Simon Clubley wrote:   
   > On 2025-11-17, Arne Vajhøj wrote:   
   > But the same warning in another context can indicate   
   >> huge problem.   
   >>   
   >> And I was surprised.   
   >   
   > Interesting, but I've never encountered this because I never allow   
   > compiler warnings to stand.   
      
   Good practice.   
      
   > The GNAT RM has more information:   
   >   
   > https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/sta   
   dard_library_routines.html   
   >   
   > Search for "Ada.Unchecked_Conversion (13.9)". It also tells you what happens,   
   > at least in the case of GNAT, if you do try to use different sizes.   
   >   
   > Once you read that, you will see where the value "1" is coming from.   
      
   Truncating when moving from bigger data to smaller data is not so   
   surprising.   
      
   But truncating to max bits needed to represent logical data instead   
   of truncating to bytes used in memory surprises me.   
      
   And it is important to realize that Valid checks if resulting   
   data is valid not whether the original data was valid for   
   conversion.   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|