The case of -debug -O and: is breaking pure/@nogc/nothrow/@safe UB under -debug?

Guillaume Piolat first.last at gmail.com
Wed Apr 18 15:08:55 UTC 2018


On Wednesday, 18 April 2018 at 13:47:35 UTC, Jonathan M Davis 
wrote:
> <Exceptional answer>

Thanks for both your answers, Jonathan and Nicholas.

To the extent that I'd like to explain this in a d-idioms post, 
here is a tentative synthesis of your answers (Jonathan M Davis 
and Nicholas Wilson):

- breaking pure with -debug is UB
- breaking @nogc with -debug is definately not UB
- breaking @safe wit -debug is potentially UB, like an incorrect 
@trusted clause would be (I'm assuming adverse conditions here)
- there is disagreement between you w.r.t whether breaking 
nothrow with -debug is UB or not

Note that I'm using the "undefined behaviour" term even though 
the behaviour is quite more constrained than that, because 
readers have a notion of what "undefined behaviour" is.

For the purpose of brevity and simplicity I'll have to unify(!) 
this complicated situation in "breaking pure/@nogc/nothrow/@safe 
is Undefined Behaviour though in most cases it will work just 
fine".




More information about the Digitalmars-d-learn mailing list