APPENDIX D Internal Representation of Strings

The address representing a string is that of the first word of string characters. Each left string quote is represented internally by the word

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 17

The characters of the string which are not string quotes are packed in BCD eight characters per word. These words are in the natural order, the first immediately following the left string quote and the last immediately followed by the right string quote. If the last word before a right quote is not full, the rest of that word is filled out with zeros (not BCD blanks).

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 17

The following information may be of interest to programmers desiring an efficient program:

The Oak Ridge ALGOL Compiler for the Control Data Corporation 1604 — Part 17

1. The FOR statement is defined with more generality than is useful in most programs. In particular, the arithmetic expressions in the FOR clause are allowed to change in value during execution of the FOR statement. The compiler does not attempt to determine which FOR statements make use of this flexibility and treats all of them in the most general way. Therefore, in a statement such as

for I := 1 step M + N until abs(A - B) do ... ,

the expression M + N is evaluated twice for each iteration, and the expression abs(A - B) is evaluated once for each iteration. If M, N, A , and B do not change in the loop, this is unnecessary. Such inefficiency can be avoided by programming in a slightly different way. The above example can be written as follows:

T1 := M + N; T2 := abs(A - B) ; for I := 1 step T1 until T2 do ... .

2. The concept of call by value is a device applied to procedures to eliminate unneeded flexibility in procedure calls. If a parameter having a value is referenced more than once in the procedure body and the flexibility of call by name is not needed, then the program is more efficient if the parameter is included in the value part of the procedure heading. If such a parameter is referenced only once, it is more efficient if it is not included in the value part.

3. Array identifiers which are parameters should be specified.

APPENDIX F Controversial Features of Algol 60

A few features of the language have been subject to more than one interpretation. Fortunately, the vast majority of programs will not involve these ambiguities, but for the few that do it will be necessary to know what decisions the compiler makes. This appendix indicates these decisions for the more controversial areas.