[cfe-dev] Clang analyzer annotations
Ted Kremenek
kremenek at apple.com
Thu Jun 25 09:49:09 PDT 2009
On Jun 25, 2009, at 7:29 AM, Jean-Daniel Dupas wrote:
> Hello,
>
> I just wonder why there is an attribute to tell that a functions
> returns a retained value, but no way to tell that it will release an
> argument.
>
> It may be useful for example if you want to write a safe CFRelease
> function:
>
> static __inline__
> void SafeCFRelease(CFTypeRef cfobject) {
> if (cfobject) CFRelease(cfobject);
> }
>
> I know this attribute was available no so long ago, but I don't see it
> anymore. What was wrong with it ?
>
> Thanks
> Jean-Daniel
Hi Jean-Daniel,
Because these attributes are meant to be supported by Apple, they
actually go through an Apple-API review. The ns_returns_retained and
cf_returns_retained attributes have been approved for general use.
Discussion about supporting other attributes like the ones you
mentioned is still ongoing. Rest assured that you aren't the only one
who has voiced interest in having additional retain/release attributes.
Ted
More information about the cfe-dev
mailing list