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

fortran standard questions

tropfen
New Contributor I
474 Views
Hello,

based on problems with fortran projects based on different platforms i have started to read Chapmans book about Fortran 95/2003 for scientists 3rd edition.

Based on this book i have two questions about the fortran standard.

- pages 185ff (output devices [write statement]; control character)
In his book Chapman is writting that a control character in the format statement for write statements is needed. I have never used (needed) a control character in my CVF and IVF projects. Is this a specific behavior of IVF and CVF?

- pages 400ff (allocatable arrays in assiginment statement)
Chapman is writting that with Fortran 2003 it is possible to deallocate and reallocate an allocatable array during normal program assignments. In my personal view this should never happen. How is this Fortan 2003 specific way implemented in IVF?

Thanks in advance
Frank
0 Kudos
1 Reply
Steven_L_Intel1
Employee
474 Views

As luck would have it, I have this book.

Chapman is talking in page 185ff about "Fortran carriage control", a concept that was in Fortran standards through F95 but was removed in F2003. Traditionally, he is correct, you'd output records with a character in column 1 that specified the "channel" to which a line printer would skip. Some of us are old enough to remember line printers with a paper carriage control loop that had punches at different positions. The control character specified which hole position to advance to. (I spent too many hours of my youth repairing and replacing these paper loops when they would tear or break.)

The concept was not specific to Fortran - COBOL, RPG and other languages also had means to skip to the desired channel. You could skip to channel 2, for example, and position at line 10 (for example). It was common to have customized carriage control loops for certain applications.

The older Fortran standards specified that the first character was to be used when "printing", but over the years, with the advent of electronic terminals, this started to fade. In most present-day Fortran compilers, the default is to not use "Fortran carriage control" and thus there is no special meaning to the first position. In Intel Fortran, you can get the old meaning by opening a file with CARRIAGECONTROL='FORTRAN' (an extension).

Regarding allocatable arrays, yes, this is a behavior specified in Fortran 2003, one that is different from F90/95 (where it was required that the left side array already be allocated to the correct shape.) Intel Fortran chooses to disable this feature by default (in the current version), requiring you to ask for it with /assume:realloc_lhs
0 Kudos
Reply