Const Ideas
Craig Black
cblack at ara.com
Mon Dec 3 10:30:39 PST 2007
> "C const c" -> c is a pointer that cannot be reassigned, but you can
> modify its members.
Right.
> This violates transitivity, the property that you cannot follow a series
> of const pointers/references and end up with something mutable. It is also
> useful, but it isn't useful as a public interface sort-of-thing; it's
> useful at a relatively small scope. Which is why Walter hasn't implemented
> it; he doesn't see enough of a benefit yet.
If that is correct, then transitivity just seems like an artificial
restriction for no reason. It's not like we are violating some fundamental
law here. I still don't see a good reason not to allow "C const c" syntax.
To me, it's straightforward. However, it may complicate the compiler
implementation. I wouldn't know.
More information about the Digitalmars-d
mailing list