shared - i need it to be useful

Nicholas Wilson iamthewilsonator at hotmail.com
Wed Oct 17 00:33:38 UTC 2018


On Wednesday, 17 October 2018 at 00:29:04 UTC, Manu wrote:
> On Tue, Oct 16, 2018 at 3:25 PM Nicholas Wilson via 
> Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>>
>> On Tuesday, 16 October 2018 at 21:19:26 UTC, Steven 
>> Schveighoffer wrote:
>> > There is in fact, no difference between:
>> >
>> > int *p;
>> > shared int *p2 = p;
>> > int *p3 = cast(int*)p2;
>> >
>> > and this:
>> >
>> > int *p;
>> > shared int *p2 = p;
>> > int *p3 = p;
>>
>> If I understand Manu correctly the first should compile, and 
>> the second should error, just like if you replaces shared with 
>> const in the above.
>
> Why is the second an error?
>
> Right, for the sake of the thought experiment, replace shared 
> with const.
> The first is an abomination (casting away const)... the second 
> is just a no-op.

I missed that the third example was *p3 = p; not *p3 = p2;


More information about the Digitalmars-d mailing list