Re: Scope variable pattern
Re: Scope variable pattern
- Subject: Re: Scope variable pattern
- From: Paul Thomas <email@hidden>
- Date: Fri, 11 May 2007 17:15:44 +0100
On 11 May 2007, at 16:54, Erik Buck wrote:
I am a very accomplished C++ programmer with more than a decade of
experience writing and maintaining C++ code. I have to ask, why do
you want to replace two lines of code that are explicit and
intention revealing with the trick of relying on a side effect of
constructor/destructor semantics that conceals the intent of the
code ?
...[more indignant rage]...
Erik,
this isn't such an absurd request. Using the ctor/dtor pair in this
way is a _very_ common idiom in C++ and is known as RAII. It's main
strength is that it adds safety in the presence of exceptions. It's
not hugely surprising that you haven't come across this despite your
years in the business, C++ has such a diverse user base that people
regularly make these claims about how it should be used that whole
sectors of the industry don't agree with.
If it's piqued your interest, I recommend you join something like the
ACCU (http://accu.org/); if you have a book budget, maybe something
like "Exceptional C++" by Herb Sutter or "Effective C++" by Scott
Meyers; or just track comp.lang.c++.moderated.
To the OP - there have been some flirtations with smart pointers for
objc++. I suggest you start looking on CocoaDev and follow whatever
links you can find. I think it's gone out of fashion, but it can't
hurt to explore. Searching for "Cocoa Smart Pointer" will get you
more info.
http://www.cocoadev.com/index.pl?CocoaSTL
pt.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden