comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: What does -gnato do?
Date: Mon, 28 Aug 2006 07:49:39 -0400
Date: 2006-08-28T07:49:39-04:00	[thread overview]
Message-ID: <uhczxyt9o.fsf@stephe-leake.org> (raw)
In-Reply-To: Xns982C496A2A3B6pchapinsovernet@198.186.192.137

"Peter C. Chapin" <pchapin@sover.net> writes:

> Martin Krischik <krischik@users.sourceforge.net> 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



  reply	other threads:[~2006-08-28 11:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-26 22:52 What does -gnato do? Peter C. Chapin
2006-08-27  1:51 ` Jeffrey R. Carter
2006-08-27  8:55 ` Martin Krischik
2006-08-27 11:12   ` Peter C. Chapin
2006-08-28 11:49     ` Stephen Leake [this message]
2006-08-28 21:35       ` Jeffrey R. Carter
2006-09-05 23:37       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox