Tim Roberts wrote:
> That is not an instance of passing an "int" by reference. That is an
> instance of passing an "int *" by value. The fact that the parameter "a"
> in BumpMe happens to be an address is completely irrelevent to the
> definition of the parameter passing mechanism.
>
> C has pass-by-value, exclusively. End of story.
Trouble with Turing-complete languages. If it can be done, you can convince
a Turing-complete language to do it -- somehow.
PL/I was the converse. All parameters were passed by reference, so with
some_proc (rocks);
the code in some_proc would be working with the address of rocks. If you
wanted pass-by-value you wrote
some_proc ((rocks));
whereupon the compiler would pass in by reference an unnamed temporary
variable whose value was the expression `(rocks)`. I suspect the compiler I
used avoided FORTRAN's troubles the same way. Your function could corrupt
*a* 4, but it wouldn't corrupt the *only* 4.
Mel.
--
http://mail.python.org/mailman/listinfo/python-list