- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the topic "Declarations of Character Types" of the IVF users reference, it says:
The form CHARACTER*(*) is an obsolescent feature in Fortran 95.
I'm puzzled with the saying "CHARACTER*(*)". The question is elementary maybe, but does it mean the form of old FORTRAN standard " CHARACTER*(some_len_things)" or the * Length Character Syntax which is to be removed from the future standard ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It may be best if you forget that this form ever existed. Some old forms of Fortran may look bizarre today, until one notes that when Fortran was born computer character sets were quite small and symbols often had to be used for more than one purpose.
Since you asked, here is an example that illustrates the old notation. You want a subroutine that takes a character string as an argument and prints the length of the string. The subroutine may be called from various places with strings of various lengths.
subroutine sub(str) character*(*) str write(*,*)len(str) end subroutine
Look at the second line. The first '*' separates the type from the length specification, as in INTEGER*2. The second '*' means 'take the length from the argument at run time'. The parentheses are there because without them the expression might mean 'raise the variable to the str-th power'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"CHARACTER*(*)" is the exact syntax term - the * characters are what you would type. This form is obsolete - the preferred syntax is "CHARACTER(*)" or "CHARACTER(LEN=*)". The feature of "assumed-length", where the length comes from what is passed in, is still standard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought the OP was just subtly pointing out that the ifort docs were incomplete - CHARACTER*(*) is a fairly specific example of what's obsolescent as of F95 - the docs instead should probably call out all of the "nonkeyword" forms of the type spec (but not the equivalent star business in entity decls).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, Ian, I am missing something here. If by "nonkeyword style" you mean INTEGER*4, etc., those have never been standard. The CHARACTER* form, specifically, is obsolescent (and still is, it has not been deleted.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was referring to the terminology in the ifort documentation for "Declarations for Character Types" - https://software.intel.com/en-us/node/525492. ; It currently only calls out CHARACTER*(*) as obsolescent, but it should also call out "CHARACTER*1, CHARACTER*2, CHARACTER*3, ..., CHARACTER*(a+b), CHARACTER*(a-b), ..."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the following example, a dummy argument strh will assume the length of the associated actual argument, while the other two variables retain a length of 8:
CHARACTER *8 strg, strh(*), stri
;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for all your replies. I think the FIRST situation I assumed in the question in #1 should be the result . As lan mentioned above, I also consider a misunderstading would happen due to the ambiguous meaning of the " CHARACTER*(*) " saying. Some improvement may help I think anyway.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it - thanks, and relayed to our writers.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page