How to break const

Timon Gehr timon.gehr at gmx.ch
Mon Jun 18 09:44:42 PDT 2012


On 06/18/2012 06:30 PM, Mehrdad wrote:
> On Monday, 18 June 2012 at 16:23:39 UTC, Timon Gehr wrote:
>> I agree. Some of the keywords are poorly chosen, but this does not
>> have any actual _practical_ implications for coding. Changing them,
>> however, does.
>
>
> Not sure if this was intended to be referring to my post or not, but
> just to clarify:
>

It was not. ;)

>
> The real problem is _not_ the fact that there is a technical issue with
> const/pure/immutable/whatever.
> Like you said, that might not have any practical consequences.
>
>
> The problem is that when the compiler _uses_ const/pure/immutable to
> make decisions regarding optimizations.
>

It is important that the type system is sound.

> When that's the case, then IMHO they **MUST** be foolproof, no matter
> how rare/common they are (assuming no casts and such, to subvert the
> system).
>

This must be the case even if the compiler does not optimize.

>
> Otherwise the compiler generates wrong binaries for correct code.

Then the compiler is wrong.


More information about the Digitalmars-d mailing list