Why static analysis is the way to go
Walter Bright
newshound2 at digitalmars.com
Fri May 29 18:05:34 UTC 2026
On 5/28/2026 1:36 PM, Richard (Rikki) Andrew Cattermole wrote:
> Also please note that nothrow @nogc and pure all rely on inference to work
> correctly, and dmd is unable to do this. As a result I would suggest to think of
> them as being on the chopping block at a future point in time.
Doing inference 100% requires dealing with recursive data flow. The front end
doesn't do that. However, in cases where recursion happens, the compiler takes a
conservative approach and assumes that the attribute doesn't apply. This ensures
the code is not broken.
The easy workaround is to simply explicitly put the attribute on the recursive
function.
This is not a disastrous defect.
> We keep finding problems with them, nothrow in particular had a bug report
> within the last couple of months that we have yet to find a solution for.
That bug report is not about nothrow.
More information about the Digitalmars-d
mailing list