Thread overview
VisualD: Error disabling access to shared memory objects
September 28
If I enable "disable access to shared memory objects (DMD 2.088+)" then this simple example doesn't compile:

void main()
{
    string line;
    while ((line = stdin.readln()) !is null)
        write(line);
}

It fails with the error:

C:\D\dmd-2.094.0\windows\bin\..\..\src\phobos\std\stdio.d-mixin-4874(4874): Error: direct access to shared `stdin` is not allowed, see `core.atomic`

Can anyone explain why?
September 29
On Monday, 28 September 2020 at 22:10:58 UTC, Nuno Leiria wrote:
> If I enable "disable access to shared memory objects (DMD 2.088+)" then this simple example doesn't compile:
>
> void main()
> {
>     string line;
>     while ((line = stdin.readln()) !is null)
>         write(line);
> }
>
> It fails with the error:
>
> C:\D\dmd-2.094.0\windows\bin\..\..\src\phobos\std\stdio.d-mixin-4874(4874): Error: direct access to shared `stdin` is not allowed, see `core.atomic`
>
> Can anyone explain why?

Well, stdin is shared. And you have said you don't want to allow it.
September 30
On Tuesday, 29 September 2020 at 22:16:55 UTC, Imperatorn wrote:
> Well, stdin is shared. And you have said you don't want to allow it.

Thanks, can you please point me to a reference where I can learn more this behavior? I couldn't find anything about it.

And is there a way to disable access to shared memory objects on a per function basis, rather than everything at once?
October 04
On Wednesday, 30 September 2020 at 08:07:52 UTC, Nuno Leiria wrote:
> On Tuesday, 29 September 2020 at 22:16:55 UTC, Imperatorn wrote:
>> Well, stdin is shared. And you have said you don't want to allow it.
>
> Thanks, can you please point me to a reference where I can learn more this behavior? I couldn't find anything about it.
>
> And is there a way to disable access to shared memory objects on a per function basis, rather than everything at once?

https://dlang.org/spec/attribute.html