all OS functions should be "nothrow @trusted @nogc"

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 18:14:05 PDT 2017


On 7/26/17 8:09 PM, Timon Gehr wrote:
> On 27.07.2017 01:56, Andrei Alexandrescu wrote:
>> On 07/26/2017 06:16 PM, Steven Schveighoffer wrote:
>>> So I guess I should restate that we can assume no implementations 
>>> exist that intentionally cause UB when stream is NULL (as in Timon's 
>>> example).
> 
> My argument was not that we need to fear implementations that take 
> explicit measures to screw you, but UB is UB. Compilers can in principle 
> turn segfaults into any other behaviour they want, and this behaviour 
> can change between releases. I'd just rather not codify guarantees that 
> do not exist into the type system, as it is not really feasible to check 
> them, even if in practice you will in the overwhelming majority get the 
> expected behaviour.

I can't see how compilers can take advantage of this one. However, we 
can take advantage that this UB is almost universally implemented as a 
hardware segfault that ends the process.

-Steve


More information about the Digitalmars-d mailing list