[std-interval] Re: Std-interval Digest, Vol 3, Issue 6

first.i.last at comcast.net first.i.last at comcast.net
Wed Apr 5 23:02:19 PDT 2006


Alan Eliasen <eliasen at mindspring.com> writes:

>    I can see the point that aliasing could be an issue if functions are
> modifying the objects passed in.  That would seem to me to be very bad
> programming practice, (one in which explicitly declaring const-ness
> would help the compiler point these out.)

That is not the kind of aliasing that causes the problem.  The problem stems from the fact that call-by-reference provides a way to access a variable that does not prevent other access.  THus the modification would not occur in the function receiving the parameter (the callee), but in another function called by the callee, which other function had access to the objected referred to by the paremeter.  It's effectively a minor fomr of volatility which defeats powerful optimization.

Truly volatile objects can change state at any point in time.  Potentially aliased objects, whether actually aliased or not, can logically change state any time a non-transparent function is called.

This is a classic complaint about C from FORTRAN users.

-- Lee Winter


More information about the Std-interval mailing list