<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 17 Aug 2024 at 18:42, ryuukk_ via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">```<br>
import core.stdc.stdio;<br>
<br>
void main()<br>
{<br>
     assert(false, "no");<br>
}<br>
<br>
extern(C) void _d_assert_msg (string msg, string file, uint line)<br>
{<br>
     printf("assert failed: %.*s:%u %.*s\n", cast(int)file.length, <br>
file.ptr, line, cast(int)msg.length, msg.ptr);<br>
}<br>
```<br>
<br>
```<br>
assert failed: onlineapp.d:4 no<br>
```<br>
<br>
<br>
This works<br>
<br>
That's funny, because i was thinking about that just right now, <br>
and how the default message of druntime sucks ass<br>
<br>
```<br>
core.exception.AssertError@onlineapp.d(5): no<br>
----------------<br>
??:? _d_assert_msg [0x5625e324e580]<br>
./onlineapp.d:5 _Dmain [0x5625e324e4e4]<br>
<br>
```<br>
<br>
<br>
assert message is obfuscated and surrounded with unpleasant <br>
characters to read, it should be clear by default, i want to send <br>
a PR but i can't be bothered to read druntime codebase, a waste <br>
of time<br></blockquote><div><br></div><div>Orly? 
My project is rather more complex than this... I'll give it some more time to find where it goes sideways.<br></div><div>What was your build cmdline? Did you link druntime?</div><div><br></div><div>I mean, there's also the `assertHandler()` stuff, but I don't really see the point; I'd rather just replace the assert handler symbol directly.<br></div><div>Using `assertHandler` is awkward because you need a static constructor to register it at runtime, and then anything you do in your assert handler almost inevitably leads to bootup issues with cyclic module dependencies because everything leads back to assert.<br></div></div></div>