\documentclass[12pt,titlepage]{article}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{color}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{hyperref}
%----Macros----------
%
% Unresolved issues:
%
% \righttoleftarrow
% \lefttorightarrow
%
% \color{} with HTML colorspec
% \bgcolor
% \array with options (without options, it's equivalent to the matrix environment)
% Of the standard HTML named colors, white, black, red, green, blue and yellow
% are predefined in the color package. Here are the rest.
\definecolor{aqua}{rgb}{0, 1.0, 1.0}
\definecolor{fuschia}{rgb}{1.0, 0, 1.0}
\definecolor{gray}{rgb}{0.502, 0.502, 0.502}
\definecolor{lime}{rgb}{0, 1.0, 0}
\definecolor{maroon}{rgb}{0.502, 0, 0}
\definecolor{navy}{rgb}{0, 0, 0.502}
\definecolor{olive}{rgb}{0.502, 0.502, 0}
\definecolor{purple}{rgb}{0.502, 0, 0.502}
\definecolor{silver}{rgb}{0.753, 0.753, 0.753}
\definecolor{teal}{rgb}{0, 0.502, 0.502}
% Because of conflicts, \space and \mathop are converted to
% \itexspace and \operatorname during preprocessing.
% itex: \space{ht}{dp}{wd}
%
% Height and baseline depth measurements are in units of tenths of an ex while
% the width is measured in tenths of an em.
\makeatletter
\newdimen\itex@wd%
\newdimen\itex@dp%
\newdimen\itex@thd%
\def\itexspace#1#2#3{\itex@wd=#3em%
\itex@wd=0.1\itex@wd%
\itex@dp=#2ex%
\itex@dp=0.1\itex@dp%
\itex@thd=#1ex%
\itex@thd=0.1\itex@thd%
\advance\itex@thd\the\itex@dp%
\makebox[\the\itex@wd]{\rule[-\the\itex@dp]{0cm}{\the\itex@thd}}}
\makeatother
% \tensor and \multiscript
\makeatletter
\newif\if@sup
\newtoks\@sups
\def\append@sup#1{\edef\act{\noexpand\@sups={\the\@sups #1}}\act}%
\def\reset@sup{\@supfalse\@sups={}}%
\def\mk@scripts#1#2{\if #2/ \if@sup ^{\the\@sups}\fi \else%
\ifx #1_ \if@sup ^{\the\@sups}\reset@sup \fi {}_{#2}%
\else \append@sup#2 \@suptrue \fi%
\expandafter\mk@scripts\fi}
\def\tensor#1#2{\reset@sup#1\mk@scripts#2_/}
\def\multiscripts#1#2#3{\reset@sup{}\mk@scripts#1_/#2%
\reset@sup\mk@scripts#3_/}
\makeatother
% \slash
\makeatletter
\newbox\slashbox \setbox\slashbox=\hbox{$/$}
\def\itex@pslash#1{\setbox\@tempboxa=\hbox{$#1$}
\@tempdima=0.5\wd\slashbox \advance\@tempdima 0.5\wd\@tempboxa
\copy\slashbox \kern-\@tempdima \box\@tempboxa}
\def\slash{\protect\itex@pslash}
\makeatother
% math-mode versions of \rlap, etc
% from Alexander Perlis, "A complement to \smash, \llap, and lap"
% http://math.arizona.edu/~aprl/publications/mathclap/
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}}
% Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2}
\let\oldroot\root
\def\root#1#2{\oldroot #1 \of{#2}}
\renewcommand{\sqrt}[2][]{\oldroot #1 \of{#2}}
% Manually declare the txfonts symbolsC font
\DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n}
\SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n}
\DeclareFontSubstitution{U}{txsyc}{m}{n}
% Manually declare the stmaryrd font
\DeclareSymbolFont{stmry}{U}{stmry}{m}{n}
\SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n}
% Manually declare the MnSymbolE font
\DeclareFontFamily{OMX}{MnSymbolE}{}
\DeclareSymbolFont{mnomx}{OMX}{MnSymbolE}{m}{n}
\SetSymbolFont{mnomx}{bold}{OMX}{MnSymbolE}{b}{n}
\DeclareFontShape{OMX}{MnSymbolE}{m}{n}{
<-6> MnSymbolE5
<6-7> MnSymbolE6
<7-8> MnSymbolE7
<8-9> MnSymbolE8
<9-10> MnSymbolE9
<10-12> MnSymbolE10
<12-> MnSymbolE12}{}
% Declare specific arrows from txfonts without loading the full package
\makeatletter
\def\re@DeclareMathSymbol#1#2#3#4{%
\let#1=\undefined
\DeclareMathSymbol{#1}{#2}{#3}{#4}}
\re@DeclareMathSymbol{\neArrow}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\neArr}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\seArrow}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\seArr}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\nwArrow}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\nwArr}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\swArrow}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\swArr}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\nequiv}{\mathrel}{symbolsC}{46}
\re@DeclareMathSymbol{\Perp}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\Vbar}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\sslash}{\mathrel}{stmry}{12}
\re@DeclareMathSymbol{\boxslash}{\mathrel}{stmry}{27}
\re@DeclareMathSymbol{\boxbslash}{\mathrel}{stmry}{28}
\re@DeclareMathSymbol{\boxast}{\mathrel}{stmry}{24}
\re@DeclareMathSymbol{\boxcircle}{\mathrel}{stmry}{29}
\re@DeclareMathSymbol{\boxbox}{\mathrel}{stmry}{30}
\re@DeclareMathSymbol{\obslash}{\mathrel}{stmry}{20}
\re@DeclareMathSymbol{\obar}{\mathrel}{stmry}{58}
\re@DeclareMathSymbol{\olessthan}{\mathrel}{stmry}{60}
\re@DeclareMathSymbol{\ogreaterthan}{\mathrel}{stmry}{61}
\re@DeclareMathSymbol{\bigsqcap}{\mathop}{stmry}{"64}
\re@DeclareMathSymbol{\biginterleave}{\mathop}{stmry}{"6}
\re@DeclareMathSymbol{\invamp}{\mathrel}{symbolsC}{77}
\re@DeclareMathSymbol{\parr}{\mathrel}{symbolsC}{77}
\makeatother
% \llangle, \rrangle, \lmoustache and \rmoustache from MnSymbolE
\makeatletter
\def\Decl@Mn@Delim#1#2#3#4{%
\if\relax\noexpand#1%
\let#1\undefined
\fi
\DeclareMathDelimiter{#1}{#2}{#3}{#4}{#3}{#4}}
\def\Decl@Mn@Open#1#2#3{\Decl@Mn@Delim{#1}{\mathopen}{#2}{#3}}
\def\Decl@Mn@Close#1#2#3{\Decl@Mn@Delim{#1}{\mathclose}{#2}{#3}}
\Decl@Mn@Open{\llangle}{mnomx}{'164}
\Decl@Mn@Close{\rrangle}{mnomx}{'171}
\Decl@Mn@Open{\lmoustache}{mnomx}{'245}
\Decl@Mn@Close{\rmoustache}{mnomx}{'244}
\Decl@Mn@Open{\llbracket}{stmry}{'112}
\Decl@Mn@Close{\rrbracket}{stmry}{'113}
\makeatother
% Widecheck
\makeatletter
\DeclareRobustCommand\widecheck[1]{{\mathpalette\@widecheck{#1}}}
\def\@widecheck#1#2{%
\setbox\z@\hbox{\m@th$#1#2$}%
\setbox\tw@\hbox{\m@th$#1%
\widehat{%
\vrule\@width\z@\@height\ht\z@
\vrule\@height\z@\@width\wd\z@}$}%
\dp\tw@-\ht\z@
\@tempdima\ht\z@ \advance\@tempdima2\ht\tw@ \divide\@tempdima\thr@@
\setbox\tw@\hbox{%
\raise\@tempdima\hbox{\scalebox{1}[-1]{\lower\@tempdima\box
\tw@}}}%
{\ooalign{\box\tw@ \cr \box\z@}}}
\makeatother
% \mathraisebox{voffset}[height][depth]{something}
\makeatletter
\NewDocumentCommand\mathraisebox{moom}{%
\IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{%
\IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}%
}{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}%
\mathpalette\@temp{#4}}
\makeatletter
% udots (taken from yhmath)
\makeatletter
\def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.}
\mkern2mu\raise4\p@\hbox{.}\mkern1mu
\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}
\makeatother
%% Fix array
\newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}}
%% \itexnum is a noop
\newcommand{\itexnum}[1]{#1}
%% Renaming existing commands
\newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}}
\newcommand{\widevec}{\overrightarrow}
\newcommand{\darr}{\downarrow}
\newcommand{\nearr}{\nearrow}
\newcommand{\nwarr}{\nwarrow}
\newcommand{\searr}{\searrow}
\newcommand{\swarr}{\swarrow}
\newcommand{\curvearrowbotright}{\curvearrowright}
\newcommand{\uparr}{\uparrow}
\newcommand{\downuparrow}{\updownarrow}
\newcommand{\duparr}{\updownarrow}
\newcommand{\updarr}{\updownarrow}
\newcommand{\gt}{>}
\newcommand{\lt}{<}
\newcommand{\map}{\mapsto}
\newcommand{\embedsin}{\hookrightarrow}
\newcommand{\Alpha}{A}
\newcommand{\Beta}{B}
\newcommand{\Zeta}{Z}
\newcommand{\Eta}{H}
\newcommand{\Iota}{I}
\newcommand{\Kappa}{K}
\newcommand{\Mu}{M}
\newcommand{\Nu}{N}
\newcommand{\Rho}{P}
\newcommand{\Tau}{T}
\newcommand{\Upsi}{\Upsilon}
\newcommand{\omicron}{o}
\newcommand{\lang}{\langle}
\newcommand{\rang}{\rangle}
\newcommand{\Union}{\bigcup}
\newcommand{\Intersection}{\bigcap}
\newcommand{\Oplus}{\bigoplus}
\newcommand{\Otimes}{\bigotimes}
\newcommand{\Wedge}{\bigwedge}
\newcommand{\Vee}{\bigvee}
\newcommand{\coproduct}{\coprod}
\newcommand{\product}{\prod}
\newcommand{\closure}{\overline}
\newcommand{\integral}{\int}
\newcommand{\doubleintegral}{\iint}
\newcommand{\tripleintegral}{\iiint}
\newcommand{\quadrupleintegral}{\iiiint}
\newcommand{\conint}{\oint}
\newcommand{\contourintegral}{\oint}
\newcommand{\infinity}{\infty}
\newcommand{\bottom}{\bot}
\newcommand{\minusb}{\boxminus}
\newcommand{\plusb}{\boxplus}
\newcommand{\timesb}{\boxtimes}
\newcommand{\intersection}{\cap}
\newcommand{\union}{\cup}
\newcommand{\Del}{\nabla}
\newcommand{\odash}{\circleddash}
\newcommand{\negspace}{\!}
\newcommand{\widebar}{\overline}
\newcommand{\textsize}{\normalsize}
\renewcommand{\scriptsize}{\scriptstyle}
\newcommand{\scriptscriptsize}{\scriptscriptstyle}
\newcommand{\mathfr}{\mathfrak}
\newcommand{\statusline}[2]{#2}
\newcommand{\tooltip}[2]{#2}
\newcommand{\toggle}[2]{#2}
% Theorem Environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{prop}{Proposition}
\newtheorem{cor}{Corollary}
\newtheorem*{utheorem}{Theorem}
\newtheorem*{ulemma}{Lemma}
\newtheorem*{uprop}{Proposition}
\newtheorem*{ucor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{example}{Example}
\newtheorem*{udefn}{Definition}
\newtheorem*{uexample}{Example}
\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem{note}{Note}
\newtheorem*{uremark}{Remark}
\newtheorem*{unote}{Note}
%-------------------------------------------------------------------
\begin{document}
%-------------------------------------------------------------------
\section*{FAQ}
\hypertarget{frequently_asked_questions_about_fortran}{}\section*{{Frequently Asked Questions About Fortran}}\label{frequently_asked_questions_about_fortran}
\hypertarget{contents}{}\subsection*{{Contents}}\label{contents}
\begin{itemize}%
\item \hyperlink{compilers}{Which Fortran compiler should I use?}
\item \hyperlink{books}{What are good books on Fortran?}
\item \hyperlink{capitalization}{How should one capitalize ``Fortran?''}
\item \hyperlink{libraries}{How do I produce a library?}
\item \hyperlink{fp-equality}{Why doesn't {\colorbox[rgb]{1.00,0.93,1.00}{\tt u\char32\char61\char61\char32\char49\char46\char52D\char48}} produce the expected result?}
\item \hyperlink{eof}{How do I read until the end of a file (EOF)?}
\item \hyperlink{getkey}{How do I read a character without having the user press enter?}
\item \hyperlink{real-precision}{How do I set the precision of real variables in Fortran 90?}
\item \hyperlink{strnum}{How do I convert a numeric variable to a string, or vice-versa}?
\item \hyperlink{cmdline}{How do I read command-line arguments?}
\item \hyperlink{tmp}{How can I create a temporary file?}
\item \hyperlink{allocstr}{Can I allocate a variable length character string?}
\item \hyperlink{fileext}{Which file extension should I use for my Fortran code?}
\item \hyperlink{array_constructor}{How do I initialize an array in row-column order?}
\item \hyperlink{short-circuit}{What is the equivalent of a short-circuiting compound conditional expression?}
\item \hyperlink{numbered_files}{Generating sequentially numbered output files}
\item \hyperlink{stderr}{How to write to stderr}
\item \hyperlink{init}{confusion about initializations and assignments}
\end{itemize}
\hypertarget{desired__feel_free_to_answer}{}\subsection*{{desired \ldots{} feel free to answer}}\label{desired__feel_free_to_answer}
\begin{itemize}%
\item \hyperlink{install}{How do I install Fortran on windows}
\item \hyperlink{ms_ide}{Which IDE do I use for windows}
\item \hyperlink{ide}{Which IDE makes it easy and installs both compiler and everything}
\item \hyperlink{uses}{What is Fortran used for ?}
\item \hyperlink{gui}{How do I make a gui in Fortran}
\item \hyperlink{fpm}{How do I use fpm}
\item \hyperlink{coarrays}{How do I use coarrays}
\end{itemize}
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{compilers}{}\subsection*{{Which Fortran compiler should I use?}}\label{compilers}
[[GFortran]], [[G95]], [[Open Watcom]], and Silverfrost are free Fortran compilers, while Absoft, IBM, [[Intel Fortran compiler|Intel]], [[LF Fortran|Lahey]], [[NAG Fortran compiler|NAG]], Pathscale, PGI, and [[Oracle Solaris Studio|Oracle]] produce commercial Fortran compilers. Polyhedron Software provides compiler comparisons at \href{https://polyhedron.com/?page_id=175}{https\char58\char47\char47polyhedron\char46com\char47\char63page\char95id\char61\char49\char55\char53}. See [[Compilers]] for more information.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{books}{}\subsection*{{What are good books on Fortran?}}\label{books}
See the [[Books]] page.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{capitalization}{}\subsection*{{How should one capitalize ``Fortran?''}}\label{capitalization}
Standard capitalization is now the preferred way to write Fortran for several reasons, most notably because that is how recent versions of the [[Standards|standard]] write it. Another reason is due to an effort to standardize the capitalization of the names of programming languages. To quote Walt Brainerd (originally from the 1997-01-03 version of Keith Bierman's Fortran FAQ):
\begin{quote}%
The rule: if you say the letters, it is all caps (APL); if you pronounce it as a word, it is not (Cobol, Fortran, Ada).
\end{quote}
Some choose to write FORTRAN when referring to older versions of the language (prior to Fortran 90) to distinguish them from newer versions.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{libraries}{}\subsection*{{How do I produce a library?}}\label{libraries}
To build a static library {\colorbox[rgb]{1.00,0.93,1.00}{\tt libfoo\char46a}} containing all modules and procedures in the {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char46f\char57\char48}} files in the current directory on Linux:
\begin{verbatim}% gfortran -c *.f90
% ar cr libfoo.a *.o\end{verbatim}
The first command builds the object files and the second archives the object files into a static archive.
To build a shared library {\colorbox[rgb]{1.00,0.93,1.00}{\tt libfoo\char46so}}:
\begin{verbatim}% gfortran -shared *.f90 -o libfoo.so -fPIC\end{verbatim}
In both cases, other compiler flags such as {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char45O\char50}} can be used.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{fp-equality}{}\subsection*{{Why doesn't {\colorbox[rgb]{1.00,0.93,1.00}{\tt u\char32\char61\char61\char32\char49\char46\char52D\char48}} produce the expected result?}}\label{fp-equality}
This has to do with the representation of real values as (binary) floating point values.
See [[Floating point arithmetic]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{eof}{}\subsection*{{How do I read until the end of a file (EOF)?}}\label{eof}
A common [[Fortran 95]] idiom for reading lines until the end of file is
\begin{verbatim}integer :: stat
character(len=100) :: buf
open(15, file='foo.txt')
do
read(fh, iostat=stat) buf
if (stat /= 0) exit
! process buf
end do
close(15)\end{verbatim}
This example catches all conditions, not just the end of file. To specifically catch the EOF in [[Fortran 2003]] one can use the [[iso\_fortran\_env]] module and replace the {\colorbox[rgb]{1.00,0.93,1.00}{\tt if}} condition above with
\begin{verbatim}if (stat == iostat_end) exit\end{verbatim}
See also: \href{http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/149d94a68d30fba3}{EOF idiom?} on [[comp.lang.fortran]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{getkey}{}\subsection*{{How do I read a character without having the user press enter?}}\label{getkey}
There isn't a portable way to do this either in Fortran or C, in short, because the terminal controls when the input is sent to your program and by default it is buffered. You must request that the terminal send each key and the method for doing so is platform-dependent.
\href{http://www.star.le.ac.uk/~cgp/fortran.html}{Clive Page's Fortran Resources} has a section on ``Reading single keystrokes from Fortran'' which provides a couple of short C functions (\href{http://www.star.le.ac.uk/~cgp/sys_keyin.c}{sys\_keyin.c}) which can be called from Fortran to achieve the desired behavior on most Unix systems.
John Urban also provides a \href{http://www.urbanjost.altervista.org/LIBRARY/libGPF/download/tmp/html/download.html}{getkey} function, written in C and callable from Fortran.
See also: \href{http://groups.google.com/groups?threadm=edf0a73b-ff05-4849-90f6-2aa93445d388@v35g2000pro.googlegroups.com}{Get Key Function?} on [[comp.lang.fortran]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{real-precision}{}\subsection*{{How do I set the precision of real variables in Fortran 90?}}\label{real-precision}
See [[Real precision]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{strnum}{}\subsection*{{How do I convert a numeric variable to a string, or vice-versa?}}\label{strnum}
There is no intrinsic procedure for converting character strings to numerical values, or vice-versa. However, this can be accomplished using internal file IO. To obtain a string representation of a numeric variable, one can perform a formatted write to a string, just as one does to a file. Similarly, a formatted read from a string can extract a numeric value. See the [[strnum]] program for an example.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{cmdline}{}\subsection*{{How do I read command-line arguments?}}\label{cmdline}
See [[Command-line arguments]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{tmp}{}\subsection*{{How can I create a temporary file?}}\label{tmp}
\begin{verbatim}open(7, form='unformatted', status='scratch')\end{verbatim}
This will create a temporary file that only lives until it is closed. It doesn't need a filename as it will not be permanently saved to disk (although it could be stored somewhere as a temporary file). In this example, the unit number is 7.
The file will be deleted when the program terminates (but may not be deleted if the program terminates abnormally, i.e. crashes). Note that it is not permitted to prevent deletion of a scratch file by closing the file using a close statement with {\colorbox[rgb]{1.00,0.93,1.00}{\tt status\char61\char39keep\char39}}.
For more details, see \href{https://fortranwiki.org/fortran/show/Scratch+Files}{scratch files}.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{allocstr}{}\subsection*{{Can I allocate a variable length character string?}}\label{allocstr}
Yes, in [[Fortran 2003]]. Declare the variable and allocate with a given length as follows:
\begin{verbatim}character(LEN=:), allocatable :: str
integer :: n
n = 27
allocate(character(LEN=n) :: str)\end{verbatim}
You will be well rewarded by reading \href{https://fortranwiki.org/fortran/files/character_handling_in_Fortran.html}{Character-handling in Fortran}
A [[Fortran 95]] solution is the [[iso\_varying\_string]] module, or the variable length string module in [[FLIBS]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{fileext}{}\subsection*{{Which file extension should I use for my Fortran code?}}\label{fileext}
Although there are no official file extensions for Fortran code, there are two widely established conventions. Some use {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char46f}} for fixed-form source and {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char46f\char57\char48}} for [[Free form layout]]. The latter is a reference to the [[Fortran 90]] standard, when [[Free form layout]] was introduced. The code contained in the file can be [[Fortran 95]], [[Fortran 2003]], etc. Others prefer to use file extensions that indicate the standard under which the code was written. For example, {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char46f\char48\char51}} for [[Fortran 2003]] code and {\colorbox[rgb]{1.00,0.93,1.00}{\tt \char46f\char48\char56}} for [[Fortran 2008]] code. Unfortunately, this results in a proliferation of file extensions and some compilers may not support the newer extensions yet.
See [[File extensions]] for more discussion on these issues.
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{array_constructor}{}\subsection*{{How do I initialize an array in row-column order?}}\label{array_constructor}
See [[array constructors]]
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{stderr}{}\subsection*{{How to write to standard error (AKA ``stderr'')}}\label{stderr}
\hypertarget{see_stderr}{}\subsection*{{See [[stderr]]}}\label{see_stderr}
\hypertarget{short-circuit}{}\subsection*{{the equivalent of a short-circuiting compound conditional expression?}}\label{short-circuit}
Fortran does not require short-circuiting compound conditional expressions. New short-circuiting expressions are expected to be supported in Fortran 202x; but how do you produce an equivalent in Fortran in general?
See [[short-circuiting ]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{numbered_files}{}\subsection*{{Generating sequentially numbered output files}}\label{numbered_files}
\textbf{Q}: How do I create numbered file names such as out\_1.txt, out\_2.txt, etc.?
\textbf{A}: Use an ``internal write'' to create the file names, which is when you write into CHARACTER variables instead of files. for example
\begin{verbatim} character(len=4096) :: file_name
write (file_name,"('out_',i0,'.txt')") i\end{verbatim}
The string prefix and suffix may be variables as well:
\begin{verbatim} write (file_name,"(a,i0,a)") 'out_',i,'.txt'\end{verbatim}
A format descriptor such as ``I0.4'' could be used instead of ``I0'' to add leading zeros to the numeric labels up to the specified number of digits.
An extended example that generates sequentially numbered files and then deletes them is at [[sequential\_filenames]].
For a related function see [[File\_Name\_Generator]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{init}{}\subsection*{{Confusion about initialization and assignment}}\label{init}
A variable declaration can only initialize a variable, not assign a value on each procedure call. This and other issues are described in [[init]].
\vspace{.5em} \hrule \vspace{.5em}
\hypertarget{external_links}{}\subsection*{{External Links}}\label{external_links}
\begin{itemize}%
\item \href{http://www.faqs.org/faqs/fortran-faq/}{The Fortran FAQ}
\item \href{http://en.wikibooks.org/wiki/Fortran/FAQ}{Fortran FAQ Wikibook}
\item \href{http://en.wikipedia.org/wiki/Fortran}{FORTRAN in Wikipedia}
\end{itemize}
\end{document}