On Wed, 2006-02-22 at 10:54 +0100, Richard Guenther wrote:
> > > > >  type T1 is range 0 .. 127;
> > > > >  -- Compiler will choose some type for T'Base, likely to be -128..127
> > > > >  -- but could be Integer (implementation dependant)
> > > > >  subtype T is T1 range 0 .. 100;
> > > > >  R : T := 100+X-X;
> > > > >  -- guaranteed work as long 100+X<=T'Base'Last and 100-X>=T'Base'First
> 
> Is the final "conversion" a checked conversion or an unchecked conversion?  
> I.e.
> are we supposed to check for overflow using 'Valid on the final result?  Or 
> will
> the value be truncated or a runtime error raised?

In the full language we are supposed to check the range on the
assignement and raise the predefined exception "CONSTRAINT_ERROR" if it
fails (whatever the way in the generated code). However GNAT by default
does not generate this kind of check, you need to add -gnato to the
compile flags.

Laurent

Reply via email to