comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@aol.com>
Subject: Re: Curious function signature issue
Date: Thu, 24 Oct 2013 15:04:28 -0700 (PDT)
Date: 2013-10-24T15:04:28-07:00	[thread overview]
Message-ID: <f6a14f2e-2934-45bd-aa45-8312448445a3@googlegroups.com> (raw)
In-Reply-To: <eb5ecb8f-461b-4852-a5cc-96d9e897610a@googlegroups.com>

On Thursday, October 24, 2013 2:12:28 PM UTC-7, RasikaSr...@gmail.com wrote:
> all
> 
> I have a package P that looks like this:
> 
> package P is
>    type Person_Type is private ;
>    function Create( targetsfile : String := "targets.dat" ;
>                     basalfile : String := "basal.dat" ;
>                     isffile : String := "isf.dat" ;
>                     icrfile : String := "icr.dat" )
>                    return Person_Type ;
>    function Create return Person_Type ;
> ....
> ....
> end P ;
 
> 
> I am curious how gnat (2013 if it matters) can distinguish between the two overloaded "Create" functions?
> 
> The project built successfully though I am yet to exercise the runtime.

> thanks for any clues, srini

You cannot use the Create function with no parameters, because Ada can't tell which one to use.  However, that doesn't prevent the package from compiling.  You won't get an error unless you actually try to use the Create function with no parameters.  (You could still define a function that renames the second Create and use that, however.)

If you're actually using P.Create with no parameters, and you're not getting an error, it's a GNAT bug.  But in that case I'd want to see a small example that demonstrates the problem, to make sure there aren't any other constructs that might be affecting something.

                              -- Adam 


      parent reply	other threads:[~2013-10-24 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24 21:12 Curious function signature issue RasikaSrinivasan
2013-10-24 22:03 ` Jeffrey Carter
2013-10-24 22:04 ` Adam Beneschan [this message]
replies disabled

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