Why D const is annoying

bearophile bearophileHUGS at lycos.com
Tue May 1 20:08:17 PDT 2012


Mehrdad:

> Notice that there are two const-related issues in the code that 
> are literally *unsolvable* (unless you avoid const/immutable 
> entirely, or unless you cast() -- but then your entire code 
> would be filled with dangerous const casts...).

Casting away casts is rather dangerous in D (more than in C++), I
kind of never do it. So just don't use const/immutable in such
cases.

Bye,
bearophile


More information about the Digitalmars-d mailing list