assert(0) behavior
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 5 09:55:45 PDT 2015
On 8/5/15 12:46 PM, Jonathan M Davis wrote:
> Well, then please comment on the PR:
> https://github.com/D-Programming-Language/druntime/pull/1337
>
> It seems to me that the whole point of abort is to work around the fact
> that Walter doesn't want assert(0) to print messages before the HLT
> instruction in release mode. Certainly, I can't see any other reason for
> it.
No, the reason is, if you want to print something before halting, and
you don't want to use any subsystems that you suspect are corrupt (e.g.
stdio), it's not a simple task. This makes it as simple as calling
assert. I thought it would be a useful utility.
Surely, we can improve core.time to throw in this case instead, since
the case where the ticksPerSecond is zero only happens when the OS did
not provide it. A slight possibility is that the memory was corrupted.
But I think the abort function still has use in other cases.
-Steve
More information about the Digitalmars-d
mailing list