Logical const

Walter Bright newshound2 at digitalmars.com
Tue Nov 30 15:03:43 PST 2010


Andrew Wiley wrote:
> 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? 

Const provides a read-only "view" of a reference and anything reachable through 
that reference. It guarantees that no other thread can read or write that 
reference or anything reachable through it.

It does not guarantee that there isn't a mutable alias to that reference 
elsewhere in the same thread that may modify it.


More information about the Digitalmars-d mailing list