shared - i need it to be useful

Manu turkeyman at gmail.com
Wed Oct 17 00:29:04 UTC 2018


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.


More information about the Digitalmars-d mailing list