Still exploring C++, I wanted to make sure the Compartment macro
didn't fire its constructor if you didn't reach it in execution,
even though it is at the highest scope of the function,
and I was pretty sure it wouldn't, but here is a little program to prove.
Think of foo as our AutoCompartment.
It constructs, unless you type in a q.
#include <iostream>
using namespace std;
class foo {
public:
foo(void) { cout << "hello\n"; }
~foo(void) { cout << "goodbye\n"; }
};
int main()
{
string s;
getline(cin, s);
if(s[0] == 'q') return 0;
foo f;
}
Karl Dahlke
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev