You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A small Java program found in a blog post:
class Flow {
static public void main(String[] args) {
for (int i = 0; i < 6; ++i) {
System.out.println("Loop: " + i);
try { try { if (i == 3) break; } finally { if (i % 2 != 0) throw new Exception(""); } } catch (Exception e) { System.out.println("Caught"); } }}
}
Its output:
Loop: 0
Loop: 1
Caught
Loop: 2
Loop: 3
Caught
Loop: 4
Loop: 5
Caught
A D translation:
import std.stdio;
void main() {
foreach (i; 0 .. 6) {
writeln("Loop: ", i);
try { try { if (i == 3) break; } finally { if (i % 2 != 0) throw new Exception(""); } } catch (Exception e) { writeln("Caught"); }}
}
dmd 2.063beta prints:
Loop: 0
Loop: 1
Caught
Loop: 2
Loop: 3
And then it crashes.
Various people in D.learn and on IRC show that maybe this fails only on 32 bit Windows.
The text was updated successfully, but these errors were encountered:
bearophile_hugs reported this on 2013-05-12T13:11:51Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10070
CC List
Description
A small Java program found in a blog post: class Flow { static public void main(String[] args) { for (int i = 0; i < 6; ++i) { System.out.println("Loop: " + i); try { try { if (i == 3) break; } finally { if (i % 2 != 0) throw new Exception(""); } } catch (Exception e) { System.out.println("Caught"); } } } } Its output: Loop: 0 Loop: 1 Caught Loop: 2 Loop: 3 Caught Loop: 4 Loop: 5 Caught A D translation: import std.stdio; void main() { foreach (i; 0 .. 6) { writeln("Loop: ", i); try { try { if (i == 3) break; } finally { if (i % 2 != 0) throw new Exception(""); } } catch (Exception e) { writeln("Caught"); } } } dmd 2.063beta prints: Loop: 0 Loop: 1 Caught Loop: 2 Loop: 3 And then it crashes. Various people in D.learn and on IRC show that maybe this fails only on 32 bit Windows.The text was updated successfully, but these errors were encountered: