[Issue 11881] -betterC switch suffers from bit rot

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 8 05:35:54 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11881



--- Comment #6 from Adam D. Ruppe <destructionator at gmail.com> 2014-01-08 05:35:46 PST ---
> Under -betterC switch, "assertion failures" and "range checks" will be
> implemented by HLT operation.

I don't think that's a great idea because if you were using this in kernel
mode, the hlt operation just pauses the CPU until the next interrupt, then it
continues on. It doesn't kill the program and doesn't even alert the user.

int 3 might be a better choice, even in kernel mode that's a debugging trap,
and it is also a one byte instruction on x86 (0xCC). I'd say either do that or
continue to generate a call to a runtime function, but just use _d_assert
without the moduleinfo argument instead of _d_assertm.

Implementing some runtime functions isn't a dealbreaker to me; we could always
just add extern(C) void _d_assert() { asm { int 3; } } or whatever easily
enough to the file when it is needed - we just want to avoid needing the full
definitions and data for module info, typeinfo, etc., as that's where the
runtime code starts to get more complicated.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list