D Article: Memory Safety

Jakob Ovrum via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Jan 20 20:45:31 PST 2016


On Wednesday, 20 January 2016 at 20:28:03 UTC, Jon D wrote:
> This is passes the @safe constraint, but 'stdout.writeln()' and 
> 'stderr.writeln()' do not. (My program uses stderr.) 
> stderr/stdout/stdin are __gshared and can't be referenced by 
> safe code. The module level version of writeln, etc., access a 
> trusted version of stdout to avoid this.

Yeah, the standard library still has a ways to go even with @safe.

I always imagined that the standard pipes should use shared as 
opposed to __gshared. I don't think the current implementation is 
thread-safe, but I don't know how this affects in memory safety 
in this case.


More information about the Digitalmars-d-announce mailing list