annotate run/c/catch_05_D.d @ 1489:b8c0195059d9

changed nntp: URLs to http: URLs
author thomask
date Mon, 09 Apr 2007 13:47:01 +0000
parents f4e98d870b57
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
593
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
1 // $HeadURL$
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
2 // $Date$
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
3 // $Author$
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
4
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
5 // @author@ Nick <Nick_member@pathlink.com>
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
6 // @date@ 2005-06-21
1489
b8c0195059d9 changed nntp: URLs to http: URLs
thomask
parents: 1090
diff changeset
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4383
593
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
8 // @desc@ foreach and throw/catch code generation
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
9
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
10 module dstress.run.c.catch_05_D;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
11
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
12 int counter;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
13
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
14 void dummy(){
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
15 counter++;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
16 }
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
17
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
18 int bb[char[]];
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
19
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
20 int main(){
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
21
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
22 bb["zwei"] = 2;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
23
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
24 assert(counter==0);
1090
f4e98d870b57 pre DMD-0.163 review
thomask
parents: 593
diff changeset
25
593
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
26 foreach(int i; bb){
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
27 dummy();
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
28 }
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
29
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
30 assert(counter==1);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
31
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
32 bb["a"] = 1;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
33
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
34 foreach(int b; bb){
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
35 try{
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
36 throw new Error("foo");
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
37 }catch(Error e){
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
38 assert(e);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
39 assert(counter==1);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
40 return 0;
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
41 }catch{
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
42 assert(0);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
43 }
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
44 assert(0);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
45 }
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
46
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
47 assert(0);
6ee3b4b671c1 forach and throw/catch code generation
thomask
parents:
diff changeset
48 }