Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

Dr Fortran strikes again in a good way.

JohnNichols
Valued Contributor III
515 Views

So my Twitter feed gets posts when Dr Fortran posts to his twitter feed, I was stuck by one a few days ago that somehow referenced the FORTLANG group. 

I have never been on the Fortran Language group, there are to many feeds, but I decided to have a look.  Someone on the Fort Lang had put up an interesting little program to start other programs using a TYPE command.  I thought the notes on the program said they were having trouble with it.  

Being your average curious guy, "look Ma - no hands" I copied the program and I had a sample project I just stick stuff into when I am curious.  The program gave me errors on missing ISO_VARYING_STRING, which upon finding and loading into the project only had one error on build. There was a misspelt variable. 

The program runs nicely, but I was intrigued, how can a TYPE contain procedures, that is a new one on me. 

Here is the code, it is Sunday afternoon and I am to lazy to go and find the string of links that got me to the code.  I will hunt it out on a workday. 

THIS IS NOT MY CODE IT IS PUBLISHED ON FORT LANG, I fixed one line and added the ISO etc file. 

 

You could almost use this as a watcher program. My current watcher program fails on some Intel NUCs. 

JMN

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
502 Views

Ah, so you discovered type-bound procedures! Those have been in the language since F2003.

ISO_VARYING_STRING was an "optional" part of Fortran 95. It used pointer components since allocatable components were not allowed until F2003. Someone did rewrite it to use allocatable components. It is largely subsumed by allocatable, deferred-length character from F2008 and was withdrawn from the standard. I'm not sure any major compiler included a copy.

0 Kudos
FortranFan
Honored Contributor II
442 Views
@Steve_Lionel wrote:

.. ISO_VARYING_STRING was an "optional" part of Fortran 95. .. It is largely subsumed by allocatable, deferred-length character from F2008  ..

See this: https://community.intel.com/t5/Intel-Fortran-Compiler/ALLOCATE-CHARACTER-N-cStr-LEN-cStr-returns-wrong-value-after/m-p/1216878/highlight/true#M152216

Deferred length CHARACTER ALLOCATABLE facility was introduced in Fortran 2003 standard revision, not 2008.

0 Kudos
Steve_Lionel
Honored Contributor III
421 Views

Sigh - that's the second time you've had to correct me on this. One of these days I'll get it right.

0 Kudos
ivanpribec
Beginner
411 Views

Hello John,

I am the author of the small command program. It was just a small weekend experiment of mine. I'm glad you found the project interesting.

With some more work I think it is possible to build a pretty decent Fortran command API. Unfortunately I lack the system programming knowledge to complete the job. Maybe in a few months (cough years), I get back to finish it.

I would be happy to learn more about your watcher program? What do you use it for and how does it work?

Best,

Ivan

 

 

 

0 Kudos
Reply