Scope variable pattern
Scope variable pattern
- Subject: Scope variable pattern
- From: Yakov Zaytsev <email@hidden>
- Date: Fri, 11 May 2007 16:10:09 +0400
Hi,
I used this pattern for ages when I was exposed to C++ world, like
this obviously
struct ScopedDoing {
ScopedDoing () { /* doing.. */ }
~ScopedDoing () { /* clean up.. */ }
};
..
<some function body>
{ ScopedDoing aScopedDoing; ...
}
..
I wonder if it's possible to implement something similar with ObjC
because I have several annoying places like this
{
NSAutoreleasePool *localPool;
locaPool = [[NSAutoreleasePool alloc] init];
<body goes here>
[localPool release];
return noErr;
}
Yeah, I use Cocoa in carbon integration frequently..
PS
To my confusion, I haven't found any ObjC Patterns related
documentation yet..
TIA
---
Yakov Zaytsev
Envion Software http://www.envionsoftware.com
<Talk Small and Carry a Big Class Library>
_______________________________________________
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