> From: Team Ada: Ada Advocacy Issues (83 & 95)
> Just a final point. As Tucker pointed out, you have a bounded error.
> Apex (and I'm guessing GNAT) conclude in the example code you provide
> that the value isn't used, therefore the erroneous value doesn't
> impact further execution of the program. This is acceptable behaviour
> under the standard.
That's true. Just to clarify, there is still a distinction between not
raising an exception under the optimization permissions granted in RM 11.6,
and the case of not raising an exception in the case of a bounded error.
> I also tried
> case Control_Data.Month is
> when January .. December =>
> Ada.Text_Io.Put_Line ("Valid month");
> when others =>
> Ada.Text_Io.Put_Line ("Invalid month");
> end case;
> And got "Invalid Month" output.
Note, the implementation is not required to give this result. It's
perfectly acceptable to get "Valid month" instead. This would happen if the
compiler is smart enough to notice that the first alternative covers the
entire base range of the type (not just the range of the subtype, though in
this case they are the same). In that case, the compiler can optimize the
whole case statement away. Apex might do this at a higher optimization
level, I don't know.