SuivantBasNiv. sup.

4.1 The Fortran Character Set 

The only characters needed to write Fortran programs, and the only ones that should be used in portable software, are those in the Fortran character set:

the 26 upper-case lettersA B C ... X Y Z
the 10 digits 0 1 2 3 4 5 6 7 8 9
and 13 special characters:
+plus -minus
* asterisk /slash
  blank =equals
( left parenthesis )right parenthesis
. decimal point ,comma
' apostrophe :colon
$ currency symbol
Although this character set is somewhat limited, it is at least universally available, which helps to make programs portable. What suffers is program legibility: lower-case letters are absent and it is necessary to resort to ugly constructions like .LT. and .GT. to represent operators like < and >. Some of the special characters, such as the asterisk and parentheses, are also rather overloaded with duties.

Blanks 

The blank, or space, character is ignored everywhere in Fortran statements (except within character constants, which are enclosed in a pair of apostrophes). Although you do not need to separate items in Fortran statements with blanks, it is good practice to include a liberal helping of them since they improve legibility and often simplify editing. The only limitation (as explained below) is that statement lines must not extend beyond column 72.

Currency Symbol 

The currency symbol has no fixed graphic representation: it appears on most systems as the dollar "$", but other forms such as "£" equally valid. This variability does not matter much because the currency symbol is not actually needed in Standard Fortran syntax.

Other Characters 

Most computers have a character set which includes many other printable characters, for example lower-case letters, square brackets, ampersands and per-cent signs. Any printable characters supported by the machine may be used in comment lines and within character constants.

The Fortran character set does not include any carriage-control characters such as tab, carriage-return, or form-feed, but formatted WRITE statements can be used to produce paginated and tabulated output files.

Fortran programs can process as data any characters supported by the local hardware. The Fortran Standard is not based on the use of any particular character code but it requires its character comparison functions to use the collating sequence of the American Standard Code for Information Interchange (ASCII). Further details are given in section 7.6.

SuivantHautNiv. sup.