パスワードを忘れた? アカウント作成
508242 journal

t-nissieの日記: g95のreshapeは文字列の場合ちと面倒、たぶんバグではないけれど

日記 by t-nissie
$ cat res.f
! res.f -*-f90-*-
!!
program res
  implicit none
  character(len=10), dimension(2,2) :: a = reshape( (/'a  ', 'abc', '1  ', '2  '/), (/2,2/) )
  character(len=10), dimension(2,2) :: b = reshape( (/'a'  , 'abc', '1'  , '2'  /), (/2,2/) )
  write(6,*) a
  write(6,*) b
end program res
$ ifort -FR res.f
$ ./a.out
a         abc       1         2
a         abc       1         2
$ g95 -ffree-form res.f
In file res.f:6

  character(len=10), dimension(2,2) :: b = reshape( (/'a'  , 'abc', '1'  , '2'
                                                             1
Error: Element in character array constructor at (1) has length 3 instead of 1
$ g95 --version
G95 (GCC 4.0.3 (g95 0.91!) Dec  6 2006)
Copyright (C) 2002-2005 Free Software Foundation, Inc.

G95 comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of G95
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
$
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

UNIXはシンプルである。必要なのはそのシンプルさを理解する素質だけである -- Dennis Ritchie

読み込み中...