[Issue 8369] try/finally block and float division by zero

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 1 10:47:19 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=8369


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-01-01 10:47:17 PST ---
First of all, it does not segfault on 2.061.

(In reply to comment #1)
> http://dpaste.dzfl.pl/f48bd90a
> 
> This one gave me some surprising results on DPaste. The results are
> inconsistent from run to run.
> 
> A few times, I got
> 
> Application output:
> a/b = nan
> Application error:
> core.exception.RangeError@/home/c891/c322.d(6): Range violation
> 
> But most of the times, I get a "successful" run without any output.

Are you sure you receive no output?

It seems for me the code works as expected. If you provide no args, you will
have array bounds exception (what actually happens). Additionally a is
defaulted to nan, so the program will also print nan in this case. 

If you provide some float as a program argument, you will receive inf, -inf or
nan depending on the argument. 

So, I don't see any problem here. I checked 2.061 on win64. If on other
platform it does not work properly, please provide source and specify platform.
Otherwise this issue can be closed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list