Logical const

Andrew Wiley debio264 at gmail.com
Tue Nov 30 14:25:35 PST 2010


2010/11/30 Walter Bright <newshound2 at digitalmars.com>

> 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++.
>
>
I've been following this thread on and off, but is there a definition
somewhere of exactly what "const" means in D2 and exactly what that
guaranties or doesn't guaranty?

>
> (One of the ironies of C++ const is that programmers assume it behaves like
> D const/immutable, but rely on it not doing so.)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101130/f1515a2e/attachment-0001.html>


More information about the Digitalmars-d mailing list