Re: Windows gfortran binaries



Beliavsky <beliavsky@xxxxxxx> wrote:

On Mar 15, 2:11 pm, Ken Fairfield <K...@xxxxxxxxxxxxxxxxxxxxx> wrote:

character (len=1), parameter :: letters(2) = (/"a","b"/)
....
integer, intent(in) :: ivec(:)
write (*,*) "a" // letters(ivec)
....
Is "letters(ivec)" standard-conforming?
...
Yes, letters(ivec) is standard-conforming -- it is an example of a
"vector subscript", a very useful feature introduced in Fortran 90.

In addition to letters(ivec) being a vector subscript, there is one
other thing going on here that might not be obvious to some (but is fine
and standard-conforming).

Because letters(ivec) is an array, the concatenation here is an
elemental operation. Suppose, by way of example, that ivec=[1,2,2], so
that letters(ivec)=["a","b","b"]. The concatenation does *NOT*
concatenate the elements of the array together. Instead, it elementally
concatenates the scalar "a" with each element of the array. Thus
"a"//letters(ivec) evaluates to the array ["aa","ab","ab"].

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • using a vector to specify an array location (vector subscript for a 2+ rank array)
    ... I have a problem where I believe a vector subscript would be the ... uses a rank-1 array as the specifier for another array in order to ... this storage mechanism of the structure of the points (panel list) ...
    (comp.lang.fortran)
  • Re: Reversing Array Elements?
    ... an array reference. ... Some compilers ... pair to construct the vector subscript. ... As a general rule, I'd avoid vector subscripts. ...
    (comp.lang.fortran)
  • Re: Does VBscript support " & _" for long strings?
    ... With 1000 concatenations, the concatenation operator takes over 200 times longer than Join/Array. ... to an array element. ... Assigning a large string to an element in an array apparently is slightly faster than creating the same array using the Array function, but not so much that Array could be making superfluous copies of the string. ... Dim start, finish, i, total ...
    (microsoft.public.scripting.vbscript)
  • Re: Pointers and Modules
    ... > confused about target dummy arguments. ... TARGET attribute but is not an array section with a vector subscript ...
    (comp.lang.fortran)
  • Re: using a vector to specify an array location (vector subscript for a ?2+ rank array)
    ... < < I have a problem where I believe a vector subscript would be the ...  Then using vector subscripts find an element of that array.. ...   This one works, but requires a copy of the array. ... create an object to contain my pointers, since you can't make an array ...
    (comp.lang.fortran)