Logical const
Walter Bright
newshound2 at digitalmars.com
Tue Nov 30 13:56:57 PST 2010
so wrote:
> No need to go that far.
>
> void fn(const A, A) {...}
> A a;
> fn(a, a); // what do you expect here?
>
> As far as i know D/C++ have the same treatment for const member functions.
> It has been this way forever.
Yup. It's why I think it is worthwhile that I spend time in this thread
explaining things over and over. There are a lot of mistaken assumptions and
baggage people carry around about const in both D and C++.
(One of the ironies of C++ const is that programmers assume it behaves like D
const/immutable, but rely on it not doing so.)
More information about the Digitalmars-d
mailing list