| |
 | Posted by ryuukk_ in reply to Manu | Permalink Reply |
|
ryuukk_ 
| On Saturday, 17 August 2024 at 09:31:53 UTC, Manu wrote:
> On Sat, 17 Aug 2024 at 18:42, ryuukk_ via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
> 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@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
Orly? My project is rather more complex than this... I'll give it some more
time to find where it goes sideways.
What was your build cmdline? Did you link druntime?
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. 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.
I use custom runtime + -betterC, but this also works on run.dlang.io with no specific flags
Do you use -betterC? Do you load a dll? it perhaps overwrite the symbol?
|