billfor
October 9th, 2002, 09:12 AM
I am having technical difficulties on my PC, so compiling and experimenting is not an option. Therefore I need to ask a question on here.
Question: For the code below. If an exception occurs at line 7 below, then what subsequent lines of code will be executed.
I want to know if (1) The values for First and Second will ever
be set to true? And (2)Will a value be returned at line 18. If so,
will the value be false.
1 bool SomeClass::SomeMethodOfClass(void)
2 {
3 bool First(false);
4 bool Second(false);
5
6 try {
7 char *ForceError=ABC; // An exception occurs here
8 int X=5l
9 Second=true;
10 }
11 catch(...)
12 {
13 // Handle the exception !
14 }
15
16 First=True; // Will First be set to true if an exception occurs.
17
18 return First;
19
20 }
Question: For the code below. If an exception occurs at line 7 below, then what subsequent lines of code will be executed.
I want to know if (1) The values for First and Second will ever
be set to true? And (2)Will a value be returned at line 18. If so,
will the value be false.
1 bool SomeClass::SomeMethodOfClass(void)
2 {
3 bool First(false);
4 bool Second(false);
5
6 try {
7 char *ForceError=ABC; // An exception occurs here
8 int X=5l
9 Second=true;
10 }
11 catch(...)
12 {
13 // Handle the exception !
14 }
15
16 First=True; // Will First be set to true if an exception occurs.
17
18 return First;
19
20 }