YvesLeBorg
YvesLeBorg

Reputation: 9079

CCNode : help interpreting objective C , in a compound iVar assignement

In CCNode (cocos version 1.0.1), i see the following line in various setters.

isTransformDirty_ = isInverseDirty_ = YES;

My IDE whines about the fact that we are "Using a '=' in a conditional". I read this as setting both iVars to YES. Am I correct in my interpretation (and thus my faithful IDE behaving as a drama queen) ?

Upvotes: 1

Views: 65

Answers (2)

Jeeter
Jeeter

Reputation: 6085

Why not just: isTransformDirty_ = YES; and isInverseDirty_ = YES;?

Upvotes: 0

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726619

Yes, your interpretation is correct, this is an assignment of YES to both variables. You may try silencing it with parentheses (which may or may not work)

isTransformDirty_ = (isInverseDirty_ = YES);

or to add a #pragma to ignore the issue (this is highly compiler/IDE dependent).

Upvotes: 1

Related Questions