2 Feb 00:00
On character constants
Angelo Graziosi <angelo.graziosi <at> alice.it>
2010-02-01 23:00:19 GMT
2010-02-01 23:00:19 GMT
Just a curiosity...
This code:
program test_chr
implicit none
character(len=*), parameter :: NAME(0:2) = (/&
'abcd efg ',&
'ABC',&
'ABcd'/)
write(*,*) NAME
end program test_chr
builds with GCC-4.3.4, but fails using GCC-4.4.4, with the following errors:
test_chr.f90:4.21:
'abcd efg ',&
1
Error: Different CHARACTER lengths (9/3) in array constructor at (1)
test_chr.f90:7.17:
write(*,*) NAME
1
Error: Symbol 'name' at (1) has no IMPLICIT type
It seems that it wants all initializations of the same length, i.e.
character(len=*), parameter :: NAME(0:2) = (/&
'abcd efg ',&
(Continue reading)
RSS Feed