home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,782 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Simon Clubley   
   Re: Unsafe code blocks   
   17 Nov 25 15:55:10   
   
   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)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca