shared - i need it to be useful

Simen Kjærås simen.kjaras at gmail.com
Thu Oct 18 13:19:26 UTC 2018


On Thursday, 18 October 2018 at 13:09:10 UTC, Simen Kjærås wrote:
>> Ergo... you can't have functions taking pointers to shared 
>> primitives. Ergo, `shared <primitive type>` becomes a useless 
>> language construct.
>
> Yup, this is correct. But wrap it in a struct, like e.g. 
> Atomic!int, and everything's hunky-dory.

Sorry, small mistake here. You're correct that shared <primitive 
type> becomes useless, except as a way to signal that there's 
something there, and you can't touch it. I was not replying to 
the part saying 'you can't have functions taking pointers to 
shared primitives'. That's just patently false. However, I don't 
see why you'd want such a function, since it can't do anything 
with what you pass it.

--
   Simen


More information about the Digitalmars-d mailing list