function has been called with too many arguments 
Author Message
 function has been called with too many arguments

Hi all,

I've defined an external function "ATAN3" in the following program. When I
compile (/UNDEF and /DEBUG switches turned on) the program, I get a
"WARNING: FUNCTION ATAN3 has been called with too many arguments" message.
However, the program works just fine and outputs the expected results. As
far as I can tell (which isn't very far ;-), the program does call the
"ATAN3" function with exactly two arguments, which is the correct number
according to its definition. *shrug*

Since the program (seemingly) works, I could leave it at that, but I'd
rather get rid of these warnings. Could anyone give me a clue about what's
going on?

Kind regards,

paul.

!****
program blah
 implicit none
 ![snip]
 real(kind=2) :: x1, y1, z1, ans
 real(kind=2), dimension(1:2,1:2,1:2) :: r
 real(kind=2), external :: atan3
 ![snip]
 ans = atan3( (x1*y1) , (z1*r(1,1,1)) )
 ![snip]
end program blah
!----
real(kind=2) function atan3( x , y )
 implicit none
 real(kind=2), intent(in) :: x, y
 ![snip]
 atan3 = atan2( x , y )
end function atan3
!****



Sun, 22 Feb 2004 17:27:30 GMT  
 function has been called with too many arguments


Quote:
> Hi all,

> I've defined an external function "ATAN3" in the following program. When I
> compile (/UNDEF and /DEBUG switches turned on) the program, I get a
> "WARNING: FUNCTION ATAN3 has been called with too many arguments" message.
> However, the program works just fine and outputs the expected results. As
> far as I can tell (which isn't very far ;-), the program does call the
> "ATAN3" function with exactly two arguments, which is the correct number
> according to its definition. *shrug*

> Since the program (seemingly) works, I could leave it at that, but I'd
> rather get rid of these warnings. Could anyone give me a clue about what's
> going on?

( prog snipped )

Assuming kind=2 is permisible on your system this looks fine to me.
Changing kind=2 to kind=4 and compiling on IBM and SGI with the
appropriate "obey the standard" flag gives no warnings. Compiling
on Cray only warns about variables being used before they are given
values, not very suprising really.

Even if kind=2 is NOT allowed on your machine I would be very
suprised is the resulting error was as above. So Sorry, can't help :(

Ian



Sun, 22 Feb 2004 17:58:44 GMT  
 function has been called with too many arguments

Quote:

> Hi all,

> I've defined an external function "ATAN3" in the following program. When I
> compile (/UNDEF and /DEBUG switches turned on) the program, I get a
> "WARNING: FUNCTION ATAN3 has been called with too many arguments" message.
> However, the program works just fine and outputs the expected results. As
> far as I can tell (which isn't very far ;-), the program does call the
> "ATAN3" function with exactly two arguments, which is the correct number
> according to its definition. *shrug*

> Since the program (seemingly) works, I could leave it at that, but I'd
> rather get rid of these warnings. Could anyone give me a clue about what's
> going on?

I can not be sure why, but the compiler can not know
anything about ATAN3() other than that it is something
external.

Try using a full interface definition inside the program blah.

Regards,

Arjen Markus



Sun, 22 Feb 2004 18:10:56 GMT  
 function has been called with too many arguments

I would suspect that the debug option (incorrectly) uses interface
information it has for an intrinsic ATAN3 extension.

Try renaming ATAN3 to MYFUN.

Michel

--

 http://www.ifremer.fr/metocean/group/michel/michel_olagnon.htm
 http://www.fortran-2000.com/



Sun, 22 Feb 2004 18:19:22 GMT  
 function has been called with too many arguments
Hello all,

Thanks for your input. It turned out to be a bug in my compiler version,
someone compiled the code in a newer version of the  compiler that I am
using and it did not prompt any warning. However, putting the function in a
module (as I should have in the first place, I guess) solved the problem as
well.

Thanks for your time,

paul.



Tue, 24 Feb 2004 16:47:59 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Having C++ Program Call Functions Defined for TCL

2. VC++ calling fortran function and fortran function calling a c++ function

3. Calling dll functions which need pointers to be passed as an argument

4. Rest of arguments in a function call

5. calling function as argument

6. Calling a python function with a list as the input argument from C

7. problem calling functions with default arguments

8. Call a function in DLL with string arguments?

9. Calling function with arguments

10. Calling a function, arguments in a dict ??

11. Multiple arguments, structured arguments [ LONG ] (was Re: dyadic functions)

12. Help I am having an Internal error:tpsbt.cpp line 1477

 

 
Powered by phpBB® Forum Software