Search code examples
iphoneiosobjective-cipad

Unsequenced modification and access to parameter


I'm using open source project (NSBKeyframeAnimation) for some of animations in my p roject. Here are example of methods that i'm using:

double NSBKeyframeAnimationFunctionEaseInQuad(double t,double b, double c, double d)
{
    return c*(t/=d)*t + b;
}

I have updated my Xcode to 5.0, and every method from this project started to show me warnings like this: "Unsequenced modification and access to 't' ". Should i rewrite all methods to objective-c or there's another approach to get rid of all these warnings?


Solution

  • The behavior of the expression c*(t/=d)*t + b is undefined, and you should fix it, e.g. to

    t /= d;
    return c*t*t + b;
    

    See for example Undefined behavior and sequence points for a detailed explanation.