From: Karl Dahlke <eklhad@comcast.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] scope test
Date: Wed, 12 Feb 2014 10:05:04 -0500 [thread overview]
Message-ID: <20140112100504.eklhad@comcast.net> (raw)
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
reply other threads:[~2014-02-12 15:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140112100504.eklhad@comcast.net \
--to=eklhad@comcast.net \
--cc=Edbrowse-dev@lists.the-brannons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).