FORTRAN III
■ このスレッドは過去ログ倉庫に格納されています
0165159
2005/05/21(土) 14:55:33わかりやすい例示をありがとうございます。
具体的には、以下のコードで困っています。
ちなみに、character型配列ではなく、integer型にすると、一時配列は作られません。
また、以下の例では、b は2次元配列ですが、1次元配列に変更しても一時配列は作られます。
--------------------------------------------------------
program test
character,dimension(:,:),pointer :: b
allocate(b(3,2:3))
call foo(b, size(b))
print *, b
end program test
subroutine foo(x,nmax)
integer,intent(in) :: nmax
character, dimension(nmax),intent(inout) :: x
x = '3'
end subroutine foo
--------------------------------------------------------
実行すると以下のようになります。
$ ifort -check test2.F90
fortcom: Info: Feature not yet implemented: check pointer
fortcom: Info: Feature not yet implemented: check shape
$ ./a.out
forrtl: warning (402): fort: (1): In call to FOO, an array temporary was created for argument #1
333333
■ このスレッドは過去ログ倉庫に格納されています