开发者

Nested functions are disabled - why do I get this error message?

When I accidentally wrote:

UIViewController tmp*=_currentViewController;

Instead of:

开发者_如何学Python
UIViewController *tmp=_currentViewController;

I get a nested functions are disabled error. Can you explain this?


You probably already realized this, but this:

UIViewController tmp*=_currentViewController;

is interpreted as:

UIViewController tmp *= _currentViewController;

which is an assignment by multiplication operation with a LHS that is a declaration of an object (non-pointer) named "tmp". An object pointer named "_currentViewController" is the other operand.

Thus, this simpler statement yields the same error:

int a *= b;

Normally you have something like:

a *= b;

which expands to be:

a = a * b;

However, the LHS in this case is not simply "a", but the declaration "int a".

My GUESS is that because of this weird LHS value, the compiler is interpreting the expansion of this to something like:

int a { return a * b; }

which is clearly a nested function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜