From slices to perfect imitators: opByValue

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu May 8 15:02:48 PDT 2014


On 05/08/2014 06:30 PM, Sönke Ludwig wrote:
> Am 08.05.2014 18:10, schrieb Timon Gehr:
>> On 05/08/2014 06:02 PM, monarch_dodra wrote:
>>>
>>> If you have const data referencing mutable data, then yes, you can cast
>>> away all the const you want, but at that point, it kind of makes the
>>> whole "const" thing moot.
>>
>> This is not guaranteed to work. I guess the only related thing that is
>> safe to do is casting away const, but then not modifying the memory.
>
> For what practical reason would that be the case? I know that the spec
> states "undefined behavior",

Case closed.


More information about the Digitalmars-d mailing list