Prime sieve language race

Sebastiaan Koppe mail at skoppe.eu
Wed Jul 14 19:10:55 UTC 2021


On Wednesday, 14 July 2021 at 12:08:29 UTC, ag0aep6g wrote:
> On 14.07.21 09:08, Sebastiaan Koppe wrote:
>> Why can't non-threadsafe functions be @safe? Because it might 
>> corrupt memory?
>> 
>> On a static function that is probably the right thing to do. 
>> But what about with a member function? I would argue it isn't.
>
> You would argue that a function that might corrupt memory 
> should be @trusted when it's a member function?

Because member functions are harder to call from multiple threads 
than static functions are. For one, you will have to get the 
object on two threads first. Most functions that do that require 
a shared object, which requires a diligent programmer to do the 
casting.


More information about the Digitalmars-d mailing list