comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: gnatmake error I don't understand
Date: Fri, 04 Apr 2014 20:33:57 -0400
Date: 2014-04-04T20:33:57-04:00	[thread overview]
Message-ID: <wccioqor4wa.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 9412dfa1-8fae-4396-b7cf-06ea9554de6c@googlegroups.com

drrob106@gmail.com writes:

> I was able to get this code to link by adding a separate procedure,
> testhabits.adb that merely called Habits from texthabits.

Right.  To be portable, your 'main' must be a parameterless library
procedure (not nested in a package).

> I was not aware that libraries listed in 'with' clause in a spec file
> do not need to be repeated in the body file.  I'll play with that a
> little.  I never coded this way in M-2, and I don't think that M-2
> would have allowed that.

Are you sure?  It's been a long time since I used Modula-2, but
I seem to recall it behaved like Ada in this regard.

Enable warnings!  Otherwise, you will accumulate useless "with"
clauses as you modify your code (among other problems).

> How would I write the gpr file if I were to try to have the main
> program in the package, as I've tried to do here?

GNAT does not support that.  I don't think any Ada compilers support
that.

> It is my understanding that C-flavored languages do this routinely.

Well, C doesn't have packages.  The closest thing is "translation
unit", which is basically a .c source file, and you're right that
it can contain the "main" along with other stuff.

I think this area of Ada is slightly flawed.

> At least, from what I've seen in books and articles.

- Bob


  parent reply	other threads:[~2014-04-05  0:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04  0:35 gnatmake error I don't understand agent
2014-04-04  0:44 ` agent
2014-04-04  4:14 ` Per Sandberg
2014-04-04  7:37   ` Simon Wright
2014-04-04  7:50 ` Simon Wright
2014-04-04 13:35   ` Tero Koskinen
2014-04-04 13:41   ` Robert A Duff
2014-04-04 17:14     ` Simon Wright
2014-04-04 17:45       ` Adam Beneschan
2014-04-05  0:35       ` Robert A Duff
2014-04-05  0:52         ` Adam Beneschan
2014-04-04 21:27     ` Randy Brukardt
2014-04-04 18:48 ` Stephen Leake
2014-04-04 19:25   ` Simon Wright
2014-04-04 20:02     ` drrob106
2014-04-04 20:43       ` Shark8
2014-04-04 22:58         ` Jeffrey Carter
2014-04-04 20:48       ` Simon Wright
2014-04-05  0:33       ` Robert A Duff [this message]
2014-04-05  8:17       ` Georg Bauhaus
2014-04-05 13:28         ` 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