Semantics of shared
Walter Bright
newshound1 at digitalmars.com
Thu May 14 10:20:16 PDT 2009
Matt wrote:
> You're right - it's a big departure from C++ where casting is to be
> avoided if possible, and you're right that the cast isn't safe in
> general. It's semi-reasonable because it's safe unless you cast
> somewhere and the C++ multi-threaded programming model is unsafe
> anyway. But it's bad that the bugs introduced can be quite far from
> the casts (e.g. if cast-to-unshared data is placed in a global
> thread-local somewhere).
It's not all bad. The huge advantage with "shared" is when you do a code
review, it points you to where the potential trouble spots are. With the
implicit sharing in C/C++, the whole program is a trouble spot.
More information about the Digitalmars-d
mailing list