I have a program that calls a subroutine which then calls a function. I am somewhat confused by Fortran's requirements for function type declaration. I have declared the type in the function (i.e. real function foo(...)), and the program works whether or not I declare the function in the subroutine declaration section.
My specific question is, will not declaring the function in the subroutine potentially lead to unexpected behavior in future? I have also seen the interface block and am wondering if this is necessary as well.
More generally, I am also interested in what Fortran is doing "behind the scenes" and why it would be more or less important to declare the function or use an interface block.
EDIT: Some sample code:
program foo
real :: a,b,c
call bar(a,b,c)
end program foo
subroutine bar(a,b,c)
real :: a,b,c
c = baz(a,b)
end subroutine bar
real function baz(a,b)
real :: a,b
baz = a*b
end function baz