C++/Matlab/Fortran 77
Dictionary
C
In this Appendix, we summarize the main syntactic differences between C++
(and C),Matlab,andFortran 77, and present translation tables.
- Like C++,Matlabis case-sensitive. Fortran 77is case-insensitive,
although this can be changed by raising an appropriate compiler flag. - A C++ statement may begin at any place in a line and continue in the
next line. AMatlabstatement may continue in the next line provided
that a continuation mark represented by three dots (...) is inserted at the
end of thecurrentline. AFortran 77statement must begin after the
sixth column and continue in the next line only if a character is inserted
at the sixth column of thenextline, representing a continuation mark. - In C++ andMatlab, the end of a statement is indicated by a semicolon
representing a statement delimiter. If we omit the semicolon inMatlab,
the values of variables evaluated by the statement will be printed on
the screen, sometimes flooding the output. No end-of-statement mark
is required inFortran 77. - In C++ andMatlab, two or more statements may be placed in the same
line provided they are separated with semicolons. Only one statement per
line is allowed inFortran 77. - In C++,Matlab,andFortran 77, white space is ignored. In C++ and
Matlab, a number cannot be split into two pieces separated by space.
Thus, we may not write “3.141572” as “3.141 572”. - In C++, in-line comments may be inserted following the double slash
(//). InMatlab, we use the percentage sign (%); inFortran 77,we
use the exclamation mark (!). - In C++, all text enclosed between a slash-asterisk pair (/) and the con-
verse asterisk-slash pair (/) is reckoned to be commentary and ignored
by the compiler. InMatlab, we use the percent sign at the beginning
of each line. InFortran 77, we use the exclamation mark anywhere, or
the “c” character at the beginning of each line.