Re: Language design issue: reference types, or pass-by-reference?



Nick Keighley wrote:
Michael Ekstrand <mich...@xxxxxxxxxxx> wrote:
Charlie Dawson <cd4...@xxxxxxxxx> writes:

The Java solution is simpler, but I can't help feeling that
it's not the right way to do references. It feels like a bodge.

I tend to prefer the Java solution.

The C++ solution does have some elegance; however, the lack of
syntax indicating pass-by-reference at the call site means that
it is not obvious when a function call may modify one of its
parameters.

good. That was a nasty bodge in C.

What bodge? If the parameter isn't a pointer, the function can't
modify the value. If it is a pointer, the simple use of 'const'
prevents modification. All right out in the open. C doesn't
implement pass by reference. It has adequate faults, but this
isn't one of them. If you suppress the error messages that's your
problem.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


.