__gshared implicitly convertible to shared?

Jacob Carlborg doob at me.com
Tue Nov 20 23:41:40 PST 2012


On 2012-11-20 20:14, Jonathan M Davis wrote:
> Would it make sense to make it so that __gshared implicitly converted to
> shared? It's my understanding that the main purpose of __gshared is to be able
> to better interact with C code, but given the issues with shared, lots of
> people have just used __gshared instead of shared.

I don't think it's just because there are issues with "shared". If 
"shared" means other semantics than just a global variable the D code 
will have different semantics when accessing the variable compared to 
the C code. I don't think that's a good idea. If it's not safe to just 
access the variable as is, I think it's better to add a safe wrapper 
then changing the semantics of the bindings.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list