Getting the const-correctness of Object sorted once and for all

Jonathan M Davis jmdavisProg at gmx.com
Sun May 13 21:20:23 PDT 2012


On Sunday, May 13, 2012 20:40:51 Walter Bright wrote:
> On 5/13/2012 8:19 PM, Jonathan M Davis wrote:
> > This is in definite contrast to C++ where you
> > _can_ avoid const completely if you want to.
> 
> That's because C++ const is just documentation for the programmer, and
> offers no reliable enforcement.

True, but the point is that the pros and cons of D's const and C++'s const are 
different, and wihle D's const is more powerful, that power does come with a 
cost, and it's difficult to avoid D's const completely, whereas C++'s const is 
quite easy to avoid.

- Jonathan M Davis


More information about the Digitalmars-d mailing list