A few thoughts on std.allocator

via Digitalmars-d digitalmars-d at puremagic.com
Tue May 12 23:29:40 PDT 2015


On Tuesday, 12 May 2015 at 17:21:04 UTC, Steven Schveighoffer 
wrote:
> I think shared is broken in general, the only thing that's 
> great about it is *not* shared, which is defined by the absence 
> of shared :) That is something that's easy to wrap your head 
> around.

Yes, «shared» is either broken or lacks definition. It should be 
deprecated in favour of «local». What the optimizer needs to know 
is:

1. Can the object be removed from the set of variables affected 
by a full memory barrier?

2. Is there no aliasing to the object outside of the context:

E.g.:

x++;
y.f();
x--;

Is it safe to optimize this to:

y.f();

?


More information about the Digitalmars-d mailing list