|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
static inline void gc_ptr_cleanup (void *pptr)
{
asm ("" :: "g" (pptr));
}
#define GC_PTR __attribute__((__cleanup__(gc_ptr_cleanup)))
const uint8_t *bytes GC_PTR = [data bytes];
const char *str GC_PTR = [string UTF8String];
This would force the compiler to hang on to the pointers until they go out of scope. I've checked and it looks like the clang and gcc's optimisations don't mess things up (at the moment).
BTW, I haven't fully tested this—I've only had a quick look at the assembler and only on i386 and x86_64 architectures.
Regards,
Chris
_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
| References: | |
| >Re: Does Mac OS X support interior pointers? (From: Greg Guerin <email@hidden>) | |
| >Re: Does Mac OS X support interior pointers? (From: Hamish Allan <email@hidden>) | |
| >Re: Does Mac OS X support interior pointers? (From: Greg Guerin <email@hidden>) | |
| >Re: Does Mac OS X support interior pointers? (From: Bill Bumgarner <email@hidden>) | |
| >Re: Does Mac OS X support interior pointers? (From: Greg Guerin <email@hidden>) | |
| >Re: Does Mac OS X support interior pointers? (From: Bill Bumgarner <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.