tags:

views:

451

answers:

2

When I accidentally wrote:

UIViewController tmp*=_currentViewController;

Instead of:

UIViewController *tmp=_currentViewController;

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

+2  A: 

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.

gerry3
A: 

Hi, I find this post really interessting and it helped me solve my problem. I didn't respect the obj-c Naming norm earlier this morning and wrote that line:

UILabel *date-depart = (UILabel *)[cellVoyage viewWithTag:705];

wich resulted in the same error message described earlier.. Well, the issue is solved now but I'm really wondering how did the compilator interpreted it ?

does anybody have an idea ?

Ant-