Override assert handler
ryuukk_
ryuukk.dev at gmail.com
Sat Aug 17 08:35:49 UTC 2024
```
import core.stdc.stdio;
void main()
{
assert(false, "no");
}
extern(C) void _d_assert_msg (string msg, string file, uint line)
{
printf("assert failed: %.*s:%u %.*s\n", cast(int)file.length,
file.ptr, line, cast(int)msg.length, msg.ptr);
}
```
```
assert failed: onlineapp.d:4 no
```
This works
That's funny, because i was thinking about that just right now,
and how the default message of druntime sucks ass
```
core.exception.AssertError at onlineapp.d(5): no
----------------
??:? _d_assert_msg [0x5625e324e580]
./onlineapp.d:5 _Dmain [0x5625e324e4e4]
```
assert message is obfuscated and surrounded with unpleasant
characters to read, it should be clear by default, i want to send
a PR but i can't be bothered to read druntime codebase, a waste
of time
More information about the Digitalmars-d
mailing list