Beta List

KennyTM~ kennytm at gmail.com
Sat May 7 05:13:41 PDT 2011


On May 7, 11 18:54, bearophile wrote:
> Jonathan M Davis:
>
>> Just a reminder in case you didn't know, but there is a beta list (dmd-beta)
>> for posting and discussing beta releases of dmd prior to actual releases.
>
> I am not yet a subscriber there. Here are some notes on 2.053beta.
>
> This little program:
>
> int foo(int x, int y) {
>      return x / y;
> }
> void main() {
>      foo(1, 0);
> }
>
>
> Produces the stack trace:
>
> object.Error: Integer Divide by Zero
> ----------------
> ...\test.d(5): _Dmain
> ----------------
>

Oh, what flags have you passed to DMD? I can only get a "Floating point 
exception" on OS X, which is, well, expected as it's the CPU that 
catches the integer-divide-by-zero error, not the language. The stack 
trace can be read by the debugger.

#0  0x00001e61 in D1y3fooFiiZi ()
#1  0x00001e4a in _Dmain ()
#2  0x00012357 in D2rt6dmain24mainUiPPaZi7runMainMFZv ()
#3  0x00011f01 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#4  0x0001239f in D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#5  0x00011f01 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#6  0x00011e9b in main ()

Throwing an exception manually does produce a stack trace up to 'foo', 
just like Python (which traps divide-by-zero in the language).



More information about the Digitalmars-d mailing list