Why is D unpopular?
Walter Bright
newshound2 at digitalmars.com
Sat May 21 03:03:41 UTC 2022
On 5/19/2022 1:17 PM, Dukc wrote:
> We can do a bit better. If an assert trips, the program will go to unknown
> state, and there's no telling what it will do. But that's still not quite the
> same as undefined behaviour.
Yes, it is. Deliberately so. In fact, the program is *already* in an unknown
state if it trips the assert. This has been extensively and exhaustively debated
several times in this n.g. I don't really want to re-litigate it.
The compiler is allowed to assume the assert holds. Whether it actually does or
not is irrelevant. If the user uses the compiler switch to turn off the asserts,
the language guarantees no longer hold, and that is the user's choice.
There were a few releases where the assert's got turned off to make the compiler
go faster. Inevitably, some mysterious crasher bugs appeared. Turning the
asserts back on detected these. The asserts are staying on.
More information about the Digitalmars-d
mailing list