I went back a little before f90 to the August 1988 draft of fortran 8x. It had two specific intrinsic functions, ESIZE(ARRAY,DIM) and DSIZE(ARRAY,DIM), that operated on real and double precision arrays. In both cases, the DIM argument was optional. Otherwise, these proposed functions worked the way that SIZE() was eventually defined in f90. I guess it did not occur to anyone at that time that it might be useful to have a SIZE() function that worked on integer, logical, complex, character, or derived type arrays? As noted above, the f90 version of SIZE() was generic.
I also noticed an error in the gfortran documentation. It states that SIZE() was added in f95, and then revised in f2003 to add the KIND optional argument. That last part is correct, but the f95 part is incorrect, it was an f90 function.
[ A single word was removed here because someone found it inappropriate. I personally donāt think it was not appropriate, given the context - but whatever. However the rest of this post should remain intact. If not, I see no reason to keep posting in this forum, because I will never ever tolerate censorship. ]
And I actually remember you now from another topic where you had the exact same blatantly offensive stance. Ok man, have it your way. Iām going to note your name this time, so that I wonāt bother again in the future.
I didnāt propagate any misinformation. Compilers did as I said. And I apologized for the fact I assumed they still do the same.
Indeed, it was a Fortran 90 function. I donāt think it was changed in Fortran 95 at all. The change happened when we ācommon mortalsā had finally access to Fortran 2003.
Not really relevant to the original question, but I was curious if the size intrinsic was available in f2c as an F8X extension. It was (is) not.
C test.f
C intrinsic sin statement recognized
intrinsic sin
C Declaration error for size: unknown intrinsic function
C intrinsic size
real a(5)
do 10 i = 1, 5
a(i) = real(i)
10 continue
print '(I5)', size(a)
end
After compiling with f2c test.f -ext, the translated C file, contains the following declarations:
/* Local variables */
static real a[5];
static integer i__;
extern doublereal size_(real *);
The size of the array (the number of elements it contains, size_a in the example below), is determined in the subroutine using the intrinsic function size. size (array, dim) returns the number of elements along a specified dimension dim. The argument dim is optional. If it not specified, size sums the number of elements in each dimension.
[ā¦] The result is a scalar of type default INTEGER. If dim is present, the result is the extent of
dimension dim of array. If dim is absent, the result is the number of elements in array.
A colleague of mine preserved a working 90ās O2 workstation from Silicon Graphics. Iāll remind myself to check what the Fortran compiler does (assuming itās still on there ) and write back to you. Trust, but verify, they sayā¦
The main compiler at work back then was Digital/Compaq Fortran. The GNU/Linux Fortran 90 compilers were at an early stage at the time, but I had access to Vast/F90 and a special free version of the NAG Fortran compiler around that time or a little later.
The Lahey compiler was out of my reach, this was not a compiler for common mortals.
The Russian aphorism that became more known after the Chernobyl TV mini series, where it is mentioned in probably one of the best moments for the show. Now I feel like the KGB is after me.
Iām kidding of course, I am also curious about what you will find. I donāt quite remember all the details, but I do know for sure that all the Fortran tutors at that time had to warn students about sizeās peculiarity. Once Fortran 2003 was accessible, I never used size without the dim optional argument, for that very reason.
is a little ambiguous, at least enough to catch your attention and read it twice. Those words might mean sum(shape(x)), which of course is not correct. The correct return value is product(shape(x)). The shape() function of course does return an array.