From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3b322104ceea062d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!208.49.83.146.MISMATCH!atl-c08.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: What does -gnato do? References: <1636357.gWrtX1Nq9K@linux1.krischik.com> From: Stephen Leake Date: Mon, 28 Aug 2006 07:49:39 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:14INfq0MZ7QVpZjzj7ukyK7/yyw= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 7dfdb44f2d853759e00d413297 Xref: g2news2.google.com comp.lang.ada:6417 Date: 2006-08-28T07:49:39-04:00 List-Id: "Peter C. Chapin" writes: > Martin Krischik wrote in > news:1636357.gWrtX1Nq9K@linux1.krischik.com: > > You are right in that if I do the overflow with values that can only be > known at run time, the -gnato makes a difference. Without the option, > the results wrap around but with the option I get Constraint_Error. > > So it seems that without -gnato the externally visible behavior of a > program depends on the extent with which the compiler can analyze the > code. If the compiler's analysis is sufficiently deep I might end up > with a Constraint_Error that I wouldn't get if the analysis was not as > deep. I'm not sure how I feel about that. It seems like a bad idea to me > although I can't articulate exactly why I feel that way. You are right to feel dismayed by such behavior; it means the program is not portable among compilers, or even compiler versions. Which is why standard Ada does not allow such behavior. GNAT without -gnato is _not_ a standard Ada compiler! In defense of GNAT, specifying -gnato does add size to the code, and it runs somewhat slower. Back when GNAT was first introduced, there were lots of rumors about how slow and bloated Ada is. So AdaCore made the decision to opt for speed and small size by default, rather than complete Ada correctness. A lot of us complained about that, but it's too late to complain about it now. -- -- Stephe