comp.lang.ada
 help / color / mirror / Atom feed
* New to ADA - not a homework
@ 2005-03-18 19:47 mieville
  2005-03-18 20:06 ` Tapio Kelloniemi
  2005-03-18 20:13 ` Marc A. Criley
  0 siblings, 2 replies; 4+ messages in thread
From: mieville @ 2005-03-18 19:47 UTC (permalink / raw)


Hi all,
Last week I started working on packages and we had few exercices to do
to practice what we just learned.
The first two went OK, I did my: package exercice1 .....; then package
body exercice1 is .... and then test_exercice1 (all three necessary
files) compile and execute flawlessly.
Now I have another the package agenda is OK but when compiling the
package body agenda is ... I have this message: "spec of this package
does not allow a body "
Any of you knows what it might be?
thanks in advance for any help - Sibyl




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New to ADA - not a homework
  2005-03-18 19:47 New to ADA - not a homework mieville
@ 2005-03-18 20:06 ` Tapio Kelloniemi
  2005-03-18 20:13 ` Marc A. Criley
  1 sibling, 0 replies; 4+ messages in thread
From: Tapio Kelloniemi @ 2005-03-18 20:06 UTC (permalink / raw)


mieville@mac.com wrote:
[--]
>Now I have another the package agenda is OK but when compiling the
>package body agenda is ... I have this message: "spec of this package
>does not allow a body "
>Any of you knows what it might be?

Perhaps your package spec does not declare any functions, procedures,
protected types, tasks, etc. which need a definition in the package
body. If your spec only has variable declarations, there is no need
for a body, since spec has all information needed to compile the package.

There is no need in Ada (as it is in C) to declare everything extern in
headers and then duplicate the declaration elsewhere.

-- 
Tapio



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New to ADA - not a homework
  2005-03-18 19:47 New to ADA - not a homework mieville
  2005-03-18 20:06 ` Tapio Kelloniemi
@ 2005-03-18 20:13 ` Marc A. Criley
  2005-03-18 20:25   ` Ed Falis
  1 sibling, 1 reply; 4+ messages in thread
From: Marc A. Criley @ 2005-03-18 20:13 UTC (permalink / raw)


mieville@mac.com wrote:
> Now I have another the package agenda is OK but when compiling the
> package body agenda is ... I have this message: "spec of this package
> does not allow a body "
> Any of you knows what it might be?

Since you're new to Ada, I'll just give you the general explanation:

A package body is required only when there's something in the spec that 
needs to be implemented in the body, i.e., a procedure or function.  So 
if your Agenda package consists only of constants/types/variables, and 
has no procedures or functions, then no Agenda package body is needed 
_or_allowed_.  Remove the file containing the package body and all will 
be well.

(Now there are ways to permit a package body to be provided anyways 
under these circumstances if it's warranted by the implementation of the 
application, but we'll just get you going with the basics first :-)

Continue to feel free to ask questions here!

Marc A. Criley
McKae Technologies
www.mckae.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: New to ADA - not a homework
  2005-03-18 20:13 ` Marc A. Criley
@ 2005-03-18 20:25   ` Ed Falis
  0 siblings, 0 replies; 4+ messages in thread
From: Ed Falis @ 2005-03-18 20:25 UTC (permalink / raw)


On Fri, 18 Mar 2005 14:13:21 -0600, Marc A. Criley <mcNOSPAM@mckae.com>  
wrote:

> (Now there are ways to permit a package body to be provided anyways  
> under these circumstances if it's warranted by the implementation of the  
> application, but we'll just get you going with the basics first

pragma Elaborate_Body in the package declaration achieves this.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-18 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-18 19:47 New to ADA - not a homework mieville
2005-03-18 20:06 ` Tapio Kelloniemi
2005-03-18 20:13 ` Marc A. Criley
2005-03-18 20:25   ` Ed Falis

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