Re: What does -gnato do?
- From: "Jeffrey R. Carter" <spam.not.jrcarter@xxxxxxxxxxxxxxxx>
- Date: Sun, 27 Aug 2006 01:51:47 GMT
Peter C. Chapin wrote:
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Check is
X : Integer := Integer'Last;
begin
X := X + 1;
Put(X);
end Check;
When I build this program *without* the -gnato option I get the following warning:
check.adb:6:11: warning: value not in range of type "Standard.Integer"
check.adb:6:11: warning: "Constraint_Error" will be raised at run time
It's apparent that the compiler has calculated the result of the addition in order to issue this warning. It may then have replaced the assignment by "raise Constraint_Error;".
Make the value of X dynamic and see if -gnato makes a difference:
X : Integer := Integer'Value (Ada.Command_Line.Argument (1) );
--
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35
.
- References:
- What does -gnato do?
- From: Peter C. Chapin
- What does -gnato do?
- Prev by Date: What does -gnato do?
- Next by Date: Re: What does -gnato do?
- Previous by thread: What does -gnato do?
- Next by thread: Re: What does -gnato do?
- Index(es):
Relevant Pages
|