Re: What does -gnato do?
- From: Stephen Leake <stephen_leake@xxxxxxxxxxxxxxxx>
- Date: Mon, 28 Aug 2006 07:49:39 -0400
"Peter C. Chapin" <pchapin@xxxxxxxxx> writes:
Martin Krischik <krischik@xxxxxxxxxxxxxxxxxxxxx> wrote in
news:1636357.gWrtX1Nq9K@xxxxxxxxxxxxxxxxxxx:
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
.
- Follow-Ups:
- Re: What does -gnato do?
- From: Jeffrey R. Carter
- Re: What does -gnato do?
- References:
- What does -gnato do?
- From: Peter C. Chapin
- Re: What does -gnato do?
- From: Martin Krischik
- Re: What does -gnato do?
- From: Peter C. Chapin
- What does -gnato do?
- Prev by Date: Re: Gnat storage size
- Next by Date: Re: Q: Portable Ada floating-point binary I/O ?
- Previous by thread: Re: What does -gnato do?
- Next by thread: Re: What does -gnato do?
- Index(es):
Relevant Pages
|