Writing Bug-Free C/D Code

Sean Kelly sean at f4.ca
Mon Mar 19 09:14:34 PDT 2007


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Henning Hasemann schrieb am 2007-03-19:
> 
> <snip>
> 
>> 2.)
>> Another thing would be easy support for stack traced exceptions.
>> I tried flectioned last weak or so (just for this purpose) but it
>> didnt want to compile with my code (I think I was still on dmd-1.007 so
>> it might have been a bug there). I think STE's are of use
>> to many developers so they should be put into phobos or so.
> 
> Exactly what problems did you encounter?

Here's one I got testing flectioned with Tango.  Notice that fnB is 
missing from the trace:

C:\code\src\d\test\flectioned>test
Uh-oh!
----------------
0x0012FE24      0x004020BA 
D4glue12traceHandlerFPvZC5tango4core9Exception19
TracedExceptionInfo15FlectionedTrace5_ctorMFPvZC4glue12traceHandlerFPvZC5tango4c
ore9Exception19TracedExceptionInfo15FlectionedTrace
0x0012FE40      0x00402081      object.ClassInfo glue.traceHandler(void*)
0x0012FE64      0x00409068      object.ClassInfo 
tango.core.Exception.traceConte
xt(void*)
0x0012FE6C      0x00402018      void test.fnA()
0x0012FE74      0x00402054      int main(char[][])

C:\code\src\d\test\flectioned>type test.d
import tango.core.Exception;
import glue;

void fnA()
{
     fnB();
}

void fnB()
{
     throw new TracedException( "Uh-oh!" );
}

void main()
{
     fnA();
}

C:\code\src\d\test\flectioned>



More information about the Digitalmars-d mailing list