Re: What does -gnato do?



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
.



Relevant Pages

  • Re: Win XP??
    ... > "Peter" wrote ... >>I would heed the warning if I were you. ... >> XP Home SP2. ... WinXP News Group. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Peter Khan
    ... far David Bowie has written nothing about Peter Khan's talks. ... >> fear of people, a sense of danger posed by flesh and blood human ... It's a loving warning ...
    (soc.religion.bahai)
  • Re: Old question new twist?
    ... Like I said before Peter, I tried that but it resulted in a macro warning ... to set the display setting for the new sheets when I add them in the code. ... But I got a macro security warning later, which I can not have and I can not ...
    (microsoft.public.excel.programming)
  • Re: To A C P Crawshaw
    ... Nobody reading his website would for one moment have assumed that he was "encouraging" anything illegal, in fact he was VERY explicit in warning against it. ... unless you have _any_ _evidence_ to support your assertions. ... When seen in the context of the original discussions, from which they have been selectively clipped, it is quite apparent that they could not be construed to be "encouragement". ...
    (uk.rec.cycling)
  • Re: Changing drive letters - question
    ... That is a standard warning, I have changed mine several times with no ... What programs do you have installed on your ROM drives. ... "Peter" <ex-brit AT rogers DOT com> wrote in message ...
    (microsoft.public.windowsxp.customize)