Re: bug in g95 with character arrays?
- From: Steve Lionel <steve.lionel@xxxxxxxxxxxxx>
- Date: Sat, 28 Jun 2008 14:38:12 GMT
wim wrote:
character(len=5), parameter :: test(5) =
["tan","atan2","atan","sin","asin"]
1
Error: Element in character array constructor at (1) has length 5
instead of 3
Does the standard say anything about what the compiler should do with
the elements in a character array that have a length shorter than the
one defined by its length, or should i always pad string parameters
with spaces by hand?
The F95 standard says that all of the elements in the array constructor have to be of the same length (type and type parameters). F2003 allows them to be different lengths and you can specify the target length with an optional type keyword, such as [character(5)::"tan","atan2","atan","sin","asin"]
Current ifort supports the mixed lengths, padding as needed to the longest length. The type specification is not supported in ifort 10.1.
By the way, the use of square brackets is also not standard in F95, but is in F03. If you want to be F95 standard conforming, pad the values and use (/ /) delimiters.
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH
For email address, replace "invalid" with "com"
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran
.
- References:
- bug in g95 with character arrays?
- From: wim
- bug in g95 with character arrays?
- Prev by Date: Re: Is it time to legitimise REAL*8 etc?
- Next by Date: Re: Is it time to legitimise REAL*8 etc?
- Previous by thread: bug in g95 with character arrays?
- Next by thread: Re: bug in g95 with character arrays?
- Index(es):
Relevant Pages
|