{"id":1579,"date":"2023-05-24T08:44:43","date_gmt":"2023-05-24T06:44:43","guid":{"rendered":"https:\/\/risc.web-email.at\/fachbeitrag-arbeiten-mit-fortran-in-2020-3\/"},"modified":"2023-11-03T08:04:30","modified_gmt":"2023-11-03T07:04:30","slug":"technical-article-working-with-fortran-in-2020-3","status":"publish","type":"publication","link":"https:\/\/risc.web-email.at\/en\/technicalarticles\/technical-article-working-with-fortran-in-2020-3\/","title":{"rendered":"Working with Fortran in 2020: Do\u2019s and Don\u2019ts"},"content":{"rendered":"\n<h2 class=\"wp-block-heading is-style-v2-telegrafico\">An etiquette guide for Fortran developers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">by DI Dr. Christoph Hofer<\/h3>\n\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><em>Fortran is one of the oldest programming languages. The name is composed of \u201e<strong>FOR<\/strong>mel <strong>TRAN<\/strong>slator\u201c. For many software developers Fortran is the archetype for an old, ponderous, limited and difficult to understand programming language, with which one would best have nothing to do. For the old versions of Fortran, this prejudice may indeed be true. However, Fortran has changed a lot in its long history, so in its \u201emodern\u201c variant (such as Fortran 2003) the language has a much worse reputation than it deserves. The typical use case for Fortran as a programming language is computationally intensive, numerical simulations such as weather forecasts, flow simulations or stability calculations.<\/em><br><br><\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center\"><div class=\"wp-block-media-text__content\">\n<p><strong>Table of contents<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>From old to new<\/li>\n\n\n\n<li>Do&#8217;s &amp; Don\u2019ts in Fortran\n<ul class=\"wp-block-list\">\n<li>Don&#8217;t use common block and equivalent statement<\/li>\n\n\n\n<li>Avoid using GOTO<\/li>\n\n\n\n<li>Avoid SAVE attributes<\/li>\n\n\n\n<li>Use implicit none<\/li>\n\n\n\n<li>Make use of derived data types and classes<\/li>\n\n\n\n<li>Use the module system<\/li>\n\n\n\n<li>Don&#8217;t rely on short-circuit evaluation<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Source<\/li>\n\n\n\n<li>Author<\/li>\n<\/ul>\n<\/div><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-1024x683.jpg\" alt=\"Do's and Don'ts scaled\" class=\"wp-image-4513 size-full\" srcset=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-1024x683.jpg 1024w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-300x200.jpg 300w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-768x512.jpg 768w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-1536x1024.jpg 1536w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachbeitrag-Fortran-DosandDOnts-RISC-Software-GmbH-2048x1365.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<h3 class=\"wp-block-heading\">From old to new<\/h3>\n\n\n\n<p>Fortran is considered as the first ever realized <strong>higher programming language<\/strong> and was developed in the years 1954 &#8211; 1957 by IBM (FORTRAN I). The scope of the language was still very limited, for example, there were only integers (integers) and reals (floating point numbers) as data types and no functions yet. In the following years new improved and more extensive Fortran versions were developed (FORTRAN II, FORTRAN III, FORTAN 66). The next big update Fortran got in 1977 (FORTRAN 77). Due to new features in the language, this version became very popular and thus quickly became \u201ethe\u201c Fortran. Even today, when talking about Fortran code, mainly FORTRAN 77 code is meant, what also explains the many prejudices against the language. Since then, there have been several more updates to the language, bringing it up to modern programming concepts and standards. Major milestones in the development were the updates to Fortran 90 and Fortran 2003, which, in addition to the change of name (FORTRAN \u2192 Fortran) added common concepts such as free source file formats, modules, <strong>operator overloading<\/strong>, <strong>derived data types<\/strong>,<strong> pointers<\/strong> and <strong>object-oriented programming<\/strong> to the programming language. In addition to this, Fortran 95 and Fortran 2008 were each minor updates to the language. The latest version of the Fortran standard is Fortran 2018, although no compiler vendor yet supports all features.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<h3 class=\"wp-block-heading\">Info<\/h3>\n\n\n<div class=\"accordion\">\n  <div class=\"accordion-header p-1.5 md:px-3 md:py-2 flex items-center justify-between \" id=\"headingblock_f93859230756e3995a86275b6b8d5db4\">\n    <h3 class=\" inline-block \">\n        Higher Programming Language    <\/h3>\n    <span class=\"accordion-icon-toggle inline-block\"><\/span>\n  <\/div>\n  <div id=\"collapseblock_f93859230756e3995a86275b6b8d5db4\" class=\"collapse\" aria-labelledby=\"headingblock_f93859230756e3995a86275b6b8d5db4\">\n    <div class=\"accordion-body p-1.5 md:p-3 \">\n      <p>Microprocessors are programmed in a so-called machine language, i.e. a binary code that is interpreted by the microprocessor as a sequence of instructions. Since these languages are very dependent on the hardware used and direct programming in a machine language is very time-consuming, the development of higher programming languages and compilers was a great step forward. Higher programming languages use mathematical expressions or expressions based on a natural language (usually English) that are translated into machine language by a compiler (and linker). Higher programming languages are independent of the hardware, the adaptation to the concrete hardware is done by the compiler.<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<div class=\"accordion\">\n  <div class=\"accordion-header p-1.5 md:px-3 md:py-2 flex items-center justify-between \" id=\"headingblock_cdb69659c8e1625b168e0742d4510efd\">\n    <h3 class=\" inline-block \">\n        Operator Overloading    <\/h3>\n    <span class=\"accordion-icon-toggle inline-block\"><\/span>\n  <\/div>\n  <div id=\"collapseblock_cdb69659c8e1625b168e0742d4510efd\" class=\"collapse\" aria-labelledby=\"headingblock_cdb69659c8e1625b168e0742d4510efd\">\n    <div class=\"accordion-body p-1.5 md:p-3 \">\n      <p>is a programming technique with which the meaning of operators (such as +, -, *, \u2026) depends on the respective types used. For example, 1 + 2 returns the number 3, but \u201cHelllo \u201d + \u201cWorld\u201d returns the string \u201cHello World\u201d.<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<div class=\"accordion\">\n  <div class=\"accordion-header p-1.5 md:px-3 md:py-2 flex items-center justify-between \" id=\"headingblock_679a2fa9709ab0f802e8ffa6e0a9f516\">\n    <h3 class=\" inline-block \">\n        Derived Data Type    <\/h3>\n    <span class=\"accordion-icon-toggle inline-block\"><\/span>\n  <\/div>\n  <div id=\"collapseblock_679a2fa9709ab0f802e8ffa6e0a9f516\" class=\"collapse\" aria-labelledby=\"headingblock_679a2fa9709ab0f802e8ffa6e0a9f516\">\n    <div class=\"accordion-body p-1.5 md:p-3 \">\n      <p>allow the user to define data types from existing types. This offers the possibility of defining logically related data in one type and reusing it in different parts of the programme.<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<div class=\"accordion\">\n  <div class=\"accordion-header p-1.5 md:px-3 md:py-2 flex items-center justify-between \" id=\"headingblock_7bf69ccf02554d97cfee0f766ff510c2\">\n    <h3 class=\" inline-block \">\n        Pointer    <\/h3>\n    <span class=\"accordion-icon-toggle inline-block\"><\/span>\n  <\/div>\n  <div id=\"collapseblock_7bf69ccf02554d97cfee0f766ff510c2\" class=\"collapse\" aria-labelledby=\"headingblock_7bf69ccf02554d97cfee0f766ff510c2\">\n    <div class=\"accordion-body p-1.5 md:p-3 \">\n      <p>is a data type that stores the memory address of a variable instead of the variable itself. Pointers refer to a memory address, so to speak, and the extraction of the value behind it is called dereferencing. In contrast to pointers in C\/C++, Fortran pointers have even more information and also allow to refer to unrelated memory areas (in the case of arrays).<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n\n\n<div class=\"accordion\">\n  <div class=\"accordion-header p-1.5 md:px-3 md:py-2 flex items-center justify-between \" id=\"headingblock_3c92f7be436de0d5e88b9ebe222927c4\">\n    <h3 class=\" inline-block \">\n        Object-oriented Programming    <\/h3>\n    <span class=\"accordion-icon-toggle inline-block\"><\/span>\n  <\/div>\n  <div id=\"collapseblock_3c92f7be436de0d5e88b9ebe222927c4\" class=\"collapse\" aria-labelledby=\"headingblock_3c92f7be436de0d5e88b9ebe222927c4\">\n    <div class=\"accordion-body p-1.5 md:p-3 \">\n      <p>is a programming style in which data is not only collected in Derived Data Types but encapsulated together with logic and functionality in so-called objects. Each object has defined interfaces through which it can interact with other objects, e.g. often not all data and functions of an object are visible to other objects. The aim is to avoid code duplications in order to reduce the potential for errors and the maintenance effort.<\/p>\n    <\/div>\n  <\/div>\n<\/div>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<h3 class=\"wp-block-heading\">Do&#8217;s &amp; Don&#8217;ts in Fortran<\/h3>\n\n\n\n<p>Due to the long development history of Fortran and in order to maintain compatibility with legacy code, there are numerous obsolete and sometimes obscure language features in current Fortran compilers. A comprehensive collection of good and bad coding practices is beyond the scope of this article. Nevertheless, we would like to present some common legacy features that can be found in legacy code, as well as selected opportunities offered by new Fortran standards. For a comprehensive list of dos and don\u2018ts, please refer to [1].<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<figure class=\"wp-block-image size-large is-style-rounded\"><img decoding=\"async\" width=\"1024\" height=\"683\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-1024x683.jpg\" alt=\"lightbulb\" class=\"wp-image-1561\" srcset=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-1024x683.jpg 1024w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-300x200.jpg 300w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-768x512.jpg 768w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-1536x1024.jpg 1536w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/Gluebirne-ok-2048x1365.jpg 2048w\" \/><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/table-cells-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Don\u2019t use common block and equivalent statement<\/h5>\n\n\n\n<p class=\"has-text-align-center\">In Fortran 77 and earlier, it was common for different variables to refer to the same memory address using common block and equivalent statement. These expressions were used to share information between subroutines or to reuse (expensive) memory for temporary variables. In the meantime, these expressions have been declared deprecated and should no longer be used. To share data between program parts, modules should be used and memory should be allocated and deallocated dynamically as needed.<\/p>\n\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/thumbs-down-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Avoid using GOTO<\/h5>\n\n\n\n<p class=\"has-text-align-center\">No other expression is as rooted in Fortran as the GOTO. In old programs you can often find an excessive use of GOTOs, partly due to the lack of alternative constructs. Over the time different variants of the GOTO developed, like the computed GOTO statement or the assigned GOTO statement. Also there were variants for the handling of loops or IF-statements, which worked with jumps to corresponding labels. In modern Fortran code, all these variants of GOTOs should be avoided if possible, and replaced by IF and SELECT case (= switch). A notable exception to the need for GOTOs in Fortran code is error management, since exceptions do not exist in Fortran.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/ban-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Avoid SAVE attributes<\/h5>\n\n\n\n<p class=\"has-text-align-center\">The SAVE attribute allows variables to retain their value in repeated function calls. Especially in conjunction with parallelization, this can lead to hard-to-find bugs and dataraces. The SAVE attribute can be safely used with variables that always have the same value on each function call to gain some performance. In all other cases it should be avoided. A particularly sneaky \u201efeature\u201c of Fortran is that all variables that are initialized the same when they are declared are automatically given an implicit SAVE attribute.<\/p>\n\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/circle-check-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Use implicit none<\/h5>\n\n\n\n<p class=\"has-text-align-center\">A concept from old Fortran standards was that undeclared variables are automatically declared as REAL &#8211; except those starting with the letter i, j, k, l, m or n, which are declared as INTEGER. This concept is very error-prone, mainly because the compiler does not give an error message if undeclared variables are used, e.g. by a typo. Because of this concept the following joke about Fortran has become common: Fortran is the only language where \u201eGod is Real\u201c applies. This automatic variable declaration can be disabled using IMPLICIT NONE for the current scope and it is \u201egood practice\u201c to implement it throughout the program code.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/bowling-ball-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Make use of derived data types and classes<\/h5>\n\n\n\n<p class=\"has-text-align-center\">With Fortran 90, the language began to develop further in the direction of object-oriented programming. With this standard User-Defined Datatypes were introduced, which allowed for the first time to use reusable structures of logically related data. Also, the concept of generics was added, so that the same function name can be used with different types (but still the function must be programmed for each type). With the Fortran 2003 standard the object-oriented programming was again forced. At the latest since this time it should be tried to encapsulate data and logic in meaningful classes and to let program parts interact over well-defined interfaces.<\/p>\n\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div data-aos=\"fade-up\"  data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\" class=\"icon-box is-style-bg-blue\">\n  <div class=\"icon-overlay\">\n          <picture>\n        \n        \n        \n        \n        <img decoding=\"async\"  class=\"\" width=\"44\" height=\"44\"\n             src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/chart-area-solid.png\"\n             alt=\"\">\n      <\/picture>\n      <\/div>\n  \n\n<h5 class=\"has-text-align-center wp-block-heading\">Use the module system<\/h5>\n\n\n\n<p class=\"has-text-align-center\">Fortran 90 also introduced a new form of program organization, namely the module system. A module consists of a set of declarations of data, functions and function interfaces, which can then be used and made visible in other program parts. In addition, modules offer the possibility to restrict the access of the contained functions\/data by means of PRIVATE\/PUBLIC. Since the Fortran 2008 standard, there are submodules, which now allow the programmer to outsource the program code into a separate submodule. The necessity for this is on the one hand to avoid very large and unclear modules, to have the interface of the module clearly visible, on the other hand also to reduce the recompilation times.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img decoding=\"async\" sizes=\"(max-width: 258px) 100vw, 258px\" src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/arrows-up-down-solid.png\" alt=\"arrows\" class=\"wp-image-1571\" width=\"65\" height=\"128\" srcset=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/arrows-up-down-solid.png 258w, https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/arrows-up-down-solid-151x300.png 151w\" \/><\/figure>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\"><strong>Don\u2019t rely on short-circuit evaluation<\/strong><\/h3>\n\n\n\n<p>Very many programming languages evaluate only the first expression in a logical combination of two expressions, if the result is already determined by this expression. This procedure is called short-circuit evaluation. In Fortran, however, it is up to the compiler whether short-circuit evaluation is used, i.e. in the Fortran standard this is not forbidden, but also not prescribed. A typical use case for the necessity of short-circuit evaluation would be:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>IF (PRESENT(x) .AND. x &gt;0) THEN<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dosomething with x<\/code><br><code>END IF<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>In Fortran there is the possibility of optional arguments, i.e. parameters of a function which do not have to be passed. With the help of the function PRESENT(x) it can be checked whether the parameter x was passed. In the example on the right, a query is made after the check whether x is greater than 0. If x is not passed, then by short-circuit evaluation the query x&gt;0 would not be made any more, since already the first condition is not fulfilled. However, the program would crash at this point due to the possible failure of short-circuit evaluation. The correct notation is the splitting on two single conditions as shown in the example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><code>IF (PRESENT(x)) THEN<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;IF(x &gt;0) THEN<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dosomething with x<\/code><br><code>&nbsp;&nbsp;&nbsp;&nbsp;END IF<\/code><br><code>END IF<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Other typical cases are queries whether a pointer is assigned to a memory address or whether a mathematical operation is allowed with the input values (division, root&#8230;).<\/p>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<h3 class=\"wp-block-heading\">Sources<\/h3>\n\n\n\n<p><em>(1) S. Chapman, Fortran for scientists &amp; engineers, McGraw-Hill Education, 4. Edition, 2017<\/em><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignfull is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<h3 class=\"wp-block-heading\">Contact<\/h3>\n\n\n\n<div class=\"wp-block-contact-form-7-contact-form-selector\">\n<div class=\"wpcf7 no-js\" id=\"wpcf7-f663-o1\" lang=\"en-US\" dir=\"ltr\" data-wpcf7-id=\"663\">\n<div class=\"screen-reader-response\"><p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"><\/p> <ul><\/ul><\/div>\n<form action=\"\/en\/wp-json\/wp\/v2\/publication\/1579#wpcf7-f663-o1\" method=\"post\" class=\"wpcf7-form init\" aria-label=\"Contact form\" novalidate=\"novalidate\" data-status=\"init\">\n<fieldset class=\"hidden-fields-container\"><input type=\"hidden\" name=\"_wpcf7\" value=\"663\" \/><input type=\"hidden\" name=\"_wpcf7_version\" value=\"6.1.5\" \/><input type=\"hidden\" name=\"_wpcf7_locale\" value=\"en_US\" \/><input type=\"hidden\" name=\"_wpcf7_unit_tag\" value=\"wpcf7-f663-o1\" \/><input type=\"hidden\" name=\"_wpcf7_container_post\" value=\"0\" \/><input type=\"hidden\" name=\"_wpcf7_posted_data_hash\" value=\"\" \/>\n<\/fieldset>\n<div class=\"form-row\">\n\t<div class=\"form-input\">\n\t\t<p><label class=\"sr-only\" for=\"your-name\">Your name <\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-name\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" id=\"your-name\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Name\" value=\"\" type=\"text\" name=\"your-name\" \/><\/span>\n\t\t<\/p>\n\t<\/div>\n\t<div class=\"form-input\">\n\t\t<p><label class=\"sr-only\" for=\"your-email\">Your email<\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-email\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-email wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-email\" id=\"your-email\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"E-Mail\" value=\"\" type=\"email\" name=\"your-email\" \/><\/span>\n\t\t<\/p>\n\t<\/div>\n<\/div>\n<div class=\"form-row\">\n\t<div class=\"form-input\">\n\t\t<p><label class=\"sr-only\" for=\"your-company\">Company <\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-company\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text\" id=\"your-company\" aria-invalid=\"false\" placeholder=\"Unternehmen\" value=\"\" type=\"text\" name=\"your-company\" \/><\/span>\n\t\t<\/p>\n\t<\/div>\n\t<div class=\"form-input\">\n\t\t<p><label class=\"sr-only\" for=\"your-position\">Position<\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-position\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text\" aria-invalid=\"false\" placeholder=\"Position\" value=\"\" type=\"text\" name=\"your-position\" \/><\/span>\n\t\t<\/p>\n\t<\/div>\n<\/div>\n<div class=\"form-row\">\n\t<div class=\"form-input\">\n\t\t<p><label class=\"sr-only\" for=\"your-subject\"> Subject <\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-subject\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" id=\"your-subject\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Thema\" value=\"\" type=\"text\" name=\"your-subject\" \/><\/span>\n\t\t<\/p>\n\t<\/div>\n<\/div>\n<p><span id=\"wpcf7-69de2337c66d4-wrapper\" class=\"wpcf7-form-control-wrap phone-95-wrap\" style=\"display:none !important; visibility:hidden !important;\"><label for=\"wpcf7-69de2337c66d4-field\" class=\"hp-message\">Please leave this field empty.<\/label><input id=\"wpcf7-69de2337c66d4-field\"  class=\"wpcf7-form-control wpcf7-text\" type=\"text\" name=\"phone-95\" value=\"\" size=\"40\" tabindex=\"-1\" autocomplete=\"new-password\" \/><\/span><br \/>\n<label class=\"sr-only\" for=\"your-message\"> Your message (optional)<\/label><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"your-message\"><textarea cols=\"40\" rows=\"10\" maxlength=\"2000\" class=\"wpcf7-form-control wpcf7-textarea\" id=\"your-message\" aria-invalid=\"false\" placeholder=\"Ihre Nachricht an uns\" name=\"your-message\"><\/textarea><\/span><br \/>\n<span class=\"wpcf7-form-control-wrap\" data-name=\"hcap-cf7\">\t\t<input\n\t\t\t\ttype=\"hidden\"\n\t\t\t\tclass=\"hcaptcha-widget-id\"\n\t\t\t\tname=\"hcaptcha-widget-id\"\n\t\t\t\tvalue=\"eyJzb3VyY2UiOlsiY29udGFjdC1mb3JtLTdcL3dwLWNvbnRhY3QtZm9ybS03LnBocCJdLCJmb3JtX2lkIjo2NjN9-5cf29316f0fc31f5a29d11a228757560\">\n\t\t\t\t<span id=\"hcap_cf7-69de2337c6d638.06195810\" class=\"wpcf7-form-control h-captcha \"\n\t\t\tdata-sitekey=\"3a6a81c1-2b2e-4b2a-b1eb-d9446bc09afb\"\n\t\t\tdata-theme=\"light\"\n\t\t\tdata-size=\"normal\"\n\t\t\tdata-auto=\"false\"\n\t\t\tdata-ajax=\"false\"\n\t\t\tdata-force=\"false\">\n\t\t<\/span>\n\t\t<input type=\"hidden\" id=\"_wpnonce\" name=\"_wpnonce\" value=\"83fc09d92f\" \/><input type=\"hidden\" name=\"_wp_http_referer\" value=\"\/en\/wp-json\/wp\/v2\/publication\/1579\" \/><\/span><input class=\"wpcf7-form-control wpcf7-submit has-spinner btn\" type=\"submit\" value=\"Senden\" \/>\n<\/p><div class=\"wpcf7-response-output\" aria-hidden=\"true\"><\/div>\n<\/form>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<h3 class=\"wp-block-heading\">Author<\/h3>\n\n\n<div class=\"contact-person\">\n      <picture>\n      \n      \n      \n      \n      <img decoding=\"async\" data-aos=\"fade-zoom-in\"\n           data-aos-offset=\"0\" class=\"w-full\" width=\"212\" height=\"293\"\n           src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/chofer1-removebg-preview.png\"\n           alt=\"\">\n    <\/picture>\n    \n\n<h5 class=\"wp-block-heading\">DI Dr. Christoph Hofer<\/h5>\n\n\n\n<p>Professional Software Engineer Unit Industrial Software Applications<\/p>\n\n  <\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n<div class=\"wp-block-group-container alignfull \">\n<div class=\"wp-block-group alignwide is-layout-constrained wp-block-group-is-layout-constrained\"><div class=\"posts-slider-block\" data-aos=\"fade-up\" data-aos-offset=\"0\" data-aos-anchor-placement=\"top-bottom\">\n        <section class=\"splide posts-slider\" aria-label=\"Gallery Slides\">\n            <div class=\"splide__arrows\">\n                <button class=\"splide__arrow splide__arrow--prev\">\n                    <span class=\"sr-only\">Previous<\/span>\n                    <img decoding=\"async\" loading=\"lazy\" width=\"25\" height=\"21\" src=\"https:\/\/risc.web-email.at\/app\/themes\/risc-theme\/public\/images\/icon-arrow.35d2ec.svg\"\n                         alt=\"Previous\">\n                <\/button>\n                <button class=\"splide__arrow splide__arrow--next\">\n                    <span class=\"sr-only\">Next<\/span>\n                    <img decoding=\"async\" loading=\"lazy\" width=\"25\" height=\"21\" src=\"https:\/\/risc.web-email.at\/app\/themes\/risc-theme\/public\/images\/icon-arrow.35d2ec.svg\"\n                         alt=\"Next\">\n                <\/button>\n            <\/div>\n            <div class=\"inner\">\n                <div class=\"splide__track\">\n                    <div class=\"splide__list\">\n\n                                                    <a href=\"https:\/\/risc.web-email.at\/en\/technicalarticles\/technical-article-working-with-fortran-in-2020\/\" class=\"splide__slide blog-post-teaser mb-1 lg:mb-3\">\n                                <div class=\"blog-image\">\n                                                                                                                                <picture>\n                                                                                        <img decoding=\"async\" src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/06\/iStock-1171721647-360x214.jpg\"\n                                                 alt=\"Working with Fortran in 2020: Areas of application\">\n                                        <\/picture>\n                                                                    <\/div>\n                                <div class=\"blog-content px-2 py-3 xl:px-4 xl:py-5\">\n                                    <h3>Working with Fortran in 2020: Areas of application<\/h3>\n                                    <div class=\"blog-post-excerpt mt-2\">\n                                        The typical use case for Fortran as a programming language is computationally intensive numerical simulations, such as weather forecasts, flow simulations, stability calculations, and many more.\n                                    <\/div>\n                                    <span class=\"inline-block mt-2 more\">mehr erfahren <span class=\"ml-1 icon-more\"><\/span><\/span>\n\n                                <\/div>\n                            <\/a>\n                                                    <a href=\"https:\/\/risc.web-email.at\/en\/technicalarticles\/technical-article-fortran-parallelisation\/\" class=\"splide__slide blog-post-teaser mb-1 lg:mb-3\">\n                                <div class=\"blog-image\">\n                                                                                                                                <picture>\n                                                                                        <img decoding=\"async\" src=\"https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fortran_2_RISC-Software-GmbH_C_iStockPhoto_doomu_AKodisinghe-360x214.jpg\"\n                                                 alt=\"Working with Fortran in 2020: Parallelisation\">\n                                        <\/picture>\n                                                                    <\/div>\n                                <div class=\"blog-content px-2 py-3 xl:px-4 xl:py-5\">\n                                    <h3>Working with Fortran in 2020: Parallelisation<\/h3>\n                                    <div class=\"blog-post-excerpt mt-2\">\n                                        Since the trend of new CPUs is clearly towards ever higher numbers of processor cores, efficient parallelization is particularly important. With Fortran, the development of high-performance code is possible.\n                                    <\/div>\n                                    <span class=\"inline-block mt-2 more\">mehr erfahren <span class=\"ml-1 icon-more\"><\/span><\/span>\n\n                                <\/div>\n                            <\/a>\n                                            <\/div>\n                <\/div>\n            <\/div>\n        <\/section>\n    <\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Due to the long development history of Fortran and to maintain compatibility with legacy code, there are numerous obsolete and sometimes obscure language features in current Fortran compilers. There are also selected capabilities offered by new Fortran standards. You can read a summary of do&#8217;s and don&#8217;ts here.<\/p>\n","protected":false},"featured_media":4506,"template":"","publication-category":[53],"class_list":["post-1579","publication","type-publication","status-publish","has-post-thumbnail","hentry","publication-category-software-reengineering-en"],"acf":[],"portrait_thumb_url":"https:\/\/risc.web-email.at\/app\/uploads\/2023\/07\/Fachebitrag-Bild_wide-360x214.jpg","_links":{"self":[{"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/publication\/1579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/publication"}],"about":[{"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/types\/publication"}],"version-history":[{"count":21,"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/publication\/1579\/revisions"}],"predecessor-version":[{"id":4980,"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/publication\/1579\/revisions\/4980"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/media\/4506"}],"wp:attachment":[{"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/media?parent=1579"}],"wp:term":[{"taxonomy":"publication-category","embeddable":true,"href":"https:\/\/risc.web-email.at\/en\/wp-json\/wp\/v2\/publication-category?post=1579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}