gast@ucla-cs.UUCP (01/28/85)
There has been some discussion about passing constants by reference and then changing them. Some attribute this to an optimizing compiler, others to other reasons. It is quite easy to test for this problem at compile time--before the optimization phase even begins. It seems clear that in any reasonable implementation of a language like FORTRAN or Pascal, such behavior should be illegal. The Berkeley pascal compiler will not, for example. IBM in a non-standard implementation feature goes one step further. (I will not comment on the advisability of using non-standard features) You can pass parameters by value, reference, or CONST. CONST is like call by reference except you cannot assign to the constant. Further, it is impossible to change that variable in a another procedure call. E.g. main calls p passing a by const. p cannot call q passing a and have q change a.