On Thursday, 12 November 2015 at 21:24:30 UTC, David Nadlinger wrote:
On Thursday, 12 November 2015 at 21:16:25 UTC, Walter Bright wrote:
[...]

Oh, GCC has had similar notions as a non-standard attribute for ages, and LLVM since its inception.

At least for LDC, the reason why we do not currently lower many of the qualifiers like pure, nothrow, immutable, etc. is that LLVM will ruthlessly consider your code to exhibit undefined behavior if you try to be clever and violate them, subsequently optimizing based on that. In other words, if you cast away const/immutable and modify a variable, for instance, you might find that the entire function body magically disappears under your feet.

Maybe it is time to revisit this, though, but last time I tried it broke druntime/Phobos in a couple of places.

That sounds awesome.

Maybe only enable it for @safe code?

Reply via email to