Program logic bugs vs input/environmental errors
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 9 11:46:49 PDT 2014
On Thursday, 9 October 2014 at 18:32:55 UTC, Marc Schütz wrote:
> Can it simply skip unwinding up to the next not-nothrow
> function? I.e. destructors of objects (and finally/scope(exit))
> inside `nothrow` functions will not be executed, but unwinding
> will continue as normal at the first function up the call stack
> that supports it?
>
> Would this work for both GDC and LDC? If yes, your unittest
> framework will probably continue to work as is.
Funny that it happens other way around right now with dmd
(http://dpaste.dzfl.pl/e685c0c32b0d) :
struct S
{
string id;
~this() nothrow
{
import core.stdc.stdio;
printf("%s\n", id.ptr);
}
}
void foo() nothrow
{
auto s = S("foo");
throw new Error("hmm");
}
void main()
{
auto s = S("main");
foo();
}
====
foo
object.Error: hmm
----------------
./f57(_Dmain+0x23) [0x4171cf]
./f57(void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll().void __lambda1()+0x18) [0x417f40]
./f57(void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate())+0x2a)
[0x417e9a]
./f57(void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll()+0x30) [0x417f00]
./f57(void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate())+0x2a)
[0x417e9a]
./f57(_d_run_main+0x1a3) [0x417e1b]
./f57(main+0x17) [0x4171f3]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x40967a15]
More information about the Digitalmars-d
mailing list