Unless I'm mistaken, there is no way in Fortran to write a function or subroutine with an arbitrary number of arguments (known more succinctly as a variadic function).
For example:
RESULT = FUNC(A1, A2 [, A3 [, ...]])
I know, I can create optional arguments, but the number of arguments is finite and must be manually declared, one by one, in the function definition.
So how then is the Fortran compiler implementing, MAX
or MIN
which are, in fact,
RESULT = MAX(A1, A2 [, A3 [, ...]])
What is especially baffling, is that these variadic MAX
and MIN
functions are, evidently, part of the Fortran 77 standard. So whatever capability exists to implement these functions must have been available around 1977.
min
in the way that we would. It can do whatever it likes (probably as a C program itself) as long as it gets the answer required of it. – Orna