comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: How to compile Barnes' examples from his book using GNAT
Date: Sun, 6 Dec 2015 11:17:29 -0700
Date: 2015-12-06T11:17:29-07:00	[thread overview]
Message-ID: <n41tv6$s1p$1@dont-email.me> (raw)
In-Reply-To: <n415t5$uko$2@dont-email.me>

On 12/06/2015 04:24 AM, Brian Drummond wrote:
> 
> So, 
> gnatchop XPROG6.txt
> gnatmake tower_of_hanoi.adb
> 
> Job done.

Almost. However, with no options, GNAT is not an Ada compiler. It doesn't insert
integer-overflow checks, stack-overflow checks, assertion checks, pre- and
post-condition checks, predicate checks, or invariant checks. The programs may
behave differently without these checks than described in the book.

In addition, it uses GNAT's static elaboration order rather than doing
elaboration as described in the ARM. This shouldn't affect the behavior of the
programs, though, so it's not really important.

The options to include all the checks in the ARM are

-gnatao -fstack-check

The option to use ARM elaboration is -gnatE.

Since we have to type options to get an Ada compiler, one might also want to use

 -gnatn -gnatwa -O2

to turn on cross-unit inlining, turn on all warnings, and perform some optimization.

The available options are described in detail in the top-secret GNAT User's Guide:

http://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn.html

-- 
Jeff Carter
"I wave my private parts at your aunties."
Monty Python & the Holy Grail
13

  reply	other threads:[~2015-12-06 18:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-06 10:49 How to compile Barnes' examples from his book using GNAT Jerry
2015-12-06 11:24 ` Brian Drummond
2015-12-06 18:17   ` Jeffrey R. Carter [this message]
2015-12-06 21:21     ` Pascal Obry
2015-12-06 22:33       ` Jeffrey R. Carter
2015-12-08  2:01         ` Randy Brukardt
2015-12-07  9:01   ` Jerry
2015-12-07  9:36     ` Jacob Sparre Andersen
2015-12-10  3:26       ` Jerry
2015-12-10  8:55         ` J-P. Rosen
2015-12-10 12:34           ` G.B.
2015-12-07 14:21     ` Simon Wright
replies disabled

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