3 ms·
> Is D GC'd by default? It has a GC, but uses it only when operator "new" is called and a couple other cases. > can you racily write slice values and observe
by WalterBright 6y ago
> Is D GC'd by default?
It has a GC, but uses it only when operator "new" is called and a couple other cases.
> can you racily write slice values and observe tearing in D?
Shared data (meaning data accessible by multiple threads) is handled separately through locking library functions. Shared data types are distinct from other types.
- titzer 6y agoCan you racily write the same field containing a slice from multiple threads? Unless you have atomic multi-word writes, you could observe tearing and go out of bounds silently. One thing that JVM guarantees is that racy programs cannot break the type system. This gets hard when you have multi-word quantities.
- WalterBright 6y ago> Can you You have to use an atomic library function to do it.