comp.lang.ada
 help / color / mirror / Atom feed
From: Larry Hazel <lhazel@mindspring.com>
Subject: Re: A question on function calls and defs.
Date: Wed, 07 Mar 2001 20:47:07 -0600
Date: 2001-03-08T02:47:10+00:00	[thread overview]
Message-ID: <3AA6F2AB.A1A12BD5@mindspring.com> (raw)
In-Reply-To: h9Cp6.36748$W05.7418581@news1.rdc1.mi.home.com

mcdoobie wrote:
> 
> Alright so I have this code that looks like this...
> 
> with Ada.Text_IO, Ada.Float_Text_IO;
> use Ada.Text_IO, Ada.Float_Text_IO;
> 
> procedure simplemath is
> 
> begin
> -- The rest of the code to the program would be here --
> 
> -- This is the section I have a question on --
> if opt_is = 'V'
>         then Put( Hi_prompt );
>                 Get( aHeight );
>                 the_volume := find_volume( aLength, aWidth, aHeight );  - Trouble here -
>                 NEW_LINE;
> ----- Cut to the Function itself -----
> 
> function find_volume( aLength, aWidth, aHeight : float ) return float is
>         volume : float
>         begin
>                 volume := aLength * aWidth * aHeight;
>         return volume;
> end find_volume;
> end simplemath;
> 
> As you can probably tell, this is a pretty damn simple program. I'm
> writing it just for practice with Ada95.
> 
> Now, the problem I'm having is that when I attempt to compile this code
> it tells me that in my call to the "find_volume" function I have too many
> arguments in the call. I'm not at all sure what that means. I'm searching
> the compiler docs to find out, however a little insight would be
> appreciated.
> 
> Now, at the function definition I'm getting the error that it's "not type
> conformant" with my simplemath.ads file.(I did write an .ads file which I
> used to generate a stub file which was then filled in with code. A really
> nice touch to the language suite if you ask me. )
> Now, I doubt anyone would want me to upload an entire .ads file to the
> newsgroup( or would they?) however I'm assuming that the error message
> itself is self-revealing to regular Ada programmers. Could someone point
> me in the right direction on this one?
> 
> Should I upload the entire source to the newsgroup? Or would that be
> considered rude?
> 
> Thanks in advance.
> 
> mcdoobie
> mcdoobie@home.com

The function spec in the .ads file must match the function definition in the
body of the package.  Sounds as if the compiler is trying to tell you they don't
match.

Larry



  reply	other threads:[~2001-03-08  2:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-08  2:30 A question on function calls and defs mcdoobie
2001-03-08  2:47 ` Larry Hazel [this message]
2001-03-08  2:55   ` mcdoobie
2001-03-09  4:55 ` Jeffrey Carter
2001-03-09 20:39   ` mcdoobie
2001-03-10 12:12     ` Jeffrey Carter
replies disabled

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