dip1000 and preview in combine to cause extra safety errors

Timon Gehr timon.gehr at gmx.ch
Sun Nov 13 08:54:57 UTC 2022


On 6/14/22 04:39, Steven Schveighoffer wrote:
> 
> They are mostly marked @system, with a smattering of @safe and @trusted.
> 
> I'll tell you what, I'll do a *whole file* at a time `winsock32.d` ...
> 
> OK, I did it in less than 10 minutes.
> 
> https://github.com/dlang/druntime/pull/3839

There is a post-merge review of that pull request that points out that 
two of the functions cannot be `@trusted`. It seems in the current 
version of druntime in DMD master [1], they are still `@trusted`. (I 
would have commented on the pull request, but it is now archived.)

[1] 
https://github.com/dlang/dmd/blob/master/druntime/src/core/sys/windows/winsock2.d

I don't know much about windows sockets, so I am not sure what is the 
best way to fix this. I guess for `inet_ntoa` we should just remove 
@trusted. For `getprotobynumber`, I am not sure if we should just remove 
@trusted or if it is sufficient to mark the return value `const` (it 
seems like it might not be. Given that it says windows sockets will 
return pointers pointing to stuff it has allocated internally, it might 
also deallocate it internally at a later point?)



More information about the Digitalmars-d mailing list