Autorelease poolを見栄えよく使うマクロ

Objective-C + C99限定なんだけど

#define pool for (NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; pool; [pool drain], pool = 0)

とかって定義しておくと

void foo() {
    pool {
        NSObject *obj = [[MyObject alloc] init];
        [obj autorelease];
    }
}

のような書き方ができることに気づいた。

や、実はすでに似たようなマクロがどこかに定義されてたりして。