On Fri, 07 Nov 2014 13:52:33 +0000 "Nordlöw" via Digitalmars-d-learn <[email protected]> wrote:
> On Friday, 7 November 2014 at 03:22:59 UTC, ketmar via > Digitalmars-d-learn wrote: > > crash+coredump is alot more useful than intercepting error > > and... > > trying to recover from undefined state? or just exit to OS, > > losing > > valuable information about a crash? > > Together with the DUB package backtrace this gives really nice ...undefined behavior. this code is not only unsafe (even in perverted D "safety"), it's plainly wrong. you are not allowed to call most of the libc functions from signal handler. actually, the things you can do safely in signal handler is setting some variable or calling _exit(2). ok, there are some more syscalls which are safe, but obviously not FILE* i/o from libc. so it doesn't matter wether i want coredumps or you want stack traces, the only correct solution is coredumps. printing stack trace from signal handler is UB, and it works only by accident. there is no good in using code that relies on UB.
signature.asc
Description: PGP signature
