const

Walter Bright newshound1 at digitalmars.com
Fri Mar 28 15:42:08 PDT 2008


Benji Smith wrote:
> I was thinking the same thing myself, which is one of the reasons I 
> dislike the constness being part of the type. In C++ "register" isn't 
> part of the type system. It's just an optimization hint.

It can't be just an optimization hint. For example, if I pass const(T*) 
to a function foo(), that means I want to guarantee that foo() does not 
change it. Having the compiler accept that foo() changes it, and so 
disable some optimization somewhere, does me no good at all.



More information about the Digitalmars-d mailing list