If you are using keywords for all of the arguments, there is no "second"
argument. The order does not matter. And you list the non-optional
second arguments in one interface as optional in the other. For
example, what does this resolve to?
call trcr_get (yunits="mks", yshort_name="xxx", idx_trcr=int1, ierr=int2)
Cheers,
Bill
On 8/22/11 10:28 AM, Oliver Fuhrer wrote:
> Dear Malcolm,
>
> Thanks for your answer. I still don't get it.
>
> If I...
>
> CALL trcr_get(ierr=myerr,idx_trcr=myidx,...)
>
> ...or...
>
> CALL trcr_get(ierr=myerr,yshort_name=myname,...)
>
> ...the compiler should know which routine I'm calling, right? These arguments are NOT optional and HAVE to be specified. Since the second argument has a different type, I don't see how this can be ambiguous, even if I have further optional arguments which might have the same type.
>
> Sorry for my stupidity,
> Oli
>
> ________________________________________
>
> Oliver Fuhrer
> Numerical Models
>
> Federal Departement of Home Affairs FDHA
> Federal Office of Meteorology and Climatology MeteoSwiss
>
> Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland
>
> Tel. +41 44 256 93 59
> Fax +41 44 256 92 78
> [log in to unmask]
> www.meteoswiss.ch - First-hand information
>
>
>
>> -----Original Message-----
>> From: Fortran 90 List [mailto:[log in to unmask]]
>> On Behalf Of Malcolm Cohen
>> Sent: Montag, 22. August 2011 11:38
>> To: [log in to unmask]
>> Subject: Re: Ambiguous interface?
>>
>>> I have overloaded a routine trcr_get by two different
>> implementations and
>>> gfortran is giving me a "Error: Ambiguous interfaces
>> 'trcr_getbyindex' and
>>> 'trcr_getbyname' in generic interface 'trcr_get'" which I
>> don't really
>>> understand. The first two arguments are non-optional and
>> positional and since
>>> the second one is of a different type (INTEGER vs.
>> CHARACTER(LEN=*)) I don't
>>> really understand why the interfaces are ambiguous. Any
>> ideas/help of how to
>>> disambiguate the situation would be appreciated!
>>
>> Yes they are ambiguous if you use keywords in the argument
>> list. Generics need
>> to be unambiguous by keyword as well as by name.
>>
>> Cheers.
>> --
>> ................................Malcolm Cohen, Nihon NAG, Tokyo.
--
Bill Long [log in to unmask]
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
|