Re: Exception Semantics question
****
You are not returning the "definition of a class", you are returning an object of that
.......................
Actually, it is a *lot* more complex than that, but it is all magic and the magic works.
For example, you cannot pass a pointer (or reference) to a stack variable across thread
boundaries. In fact, C++ is predicated on a single-thread model so cross-thread
much-of-anything is outside the scope of the language. Be careful about this.
*****
Yea I am still fooling around with it I have two projects on it now, the second one
I am looking at more stuff but too early to understand enough to ask any questions.
! However * on the first smaller project I have this question that I did not notice
earlier. Why am I getting this first chance exception on entry of the Catch
===========================
#include <iostream.h>
#include <iomanip>
class ClassNoObject
{
public:
ClassNoObject() {}
~ClassNoObject(){}
void ClsNoObjFunc()
{ cout << "Throw Or Return Temp object class printing? \n"; }
};
void GlobalFunc()
{
cout << "fixing to throw ClassDefinition? \n";
throw ClassNoObject();
}
void main(void)
{
try
{
GlobalFunc();
}
catch( ClassNoObject& E ) //<--kernel exception here
{
E.ClsNoObjFunc();
cout << "Caught throw in catch\n";
}
}
====exception oupt shown below==========
catch( ClassNoObject E ) <- point of first chance exception
{
E.ClsNoObjFunc();
cout << "Caught throw in catch\n";
}
First-chance exception in ES1b.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
The thread 0xE14 has exited with code 0 (0x0).
The thread 0x438 has exited with code 4198860 (0x4011CC).
The thread 0xD98 has exited with code 4198860 (0x4011CC).
\VC_6_Projects\Exps_&_Refs\ES1b\Debug\ES1b.exe' has exited with code 4198860 (0x4011CC).
===========================