I've inherited a new project, which has several retain cycle warnings caused by implicitly retaining self within various blocks.
In attempting to fix these, I've written
__weak typeof(self) weakSelf = self;
to create a weak reference for use within the block.
However, Xcode v. 5.1.1 is giving the cryptic warning
Lexical or Preprocessor Issue
Extension used
I'm at a loss here-- what does this mean and how can I get rid of it?
You get this warning for the use of typeof
if "Pedantic Warnings" are enabled in the build settings.
From the "Quick Help" for this setting:
Description Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any -std option used. [GCC_WARN_PEDANTIC, -pedantic]
I am not an expert in (ISO) C standards, but according to https://gcc.gnu.org/onlinedocs/gcc/Typeof.html:
If you are writing a header file that must work when included in ISO C programs, write
__typeof__
instead oftypeof
. See Alternate Keywords.
and http://clang.llvm.org/docs/UsersManual.html:
The parser recognizes “
asm
” and “typeof
” as keywords in gnu* modes; the variants “__asm__
” and “__typeof__
” are recognized in all modes.
you can use __typeof__
instead
if you don't want to disable the warning:
__weak __typeof__(self) weakSelf = self;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With