the left operand of ** is a garbage value

CapLocation location = 0;
        if (segmentedControl.tag == SegmentControlTag)
    {
        if (segmentIndex == 0)
            location = CapLeft;
        else if (segmentIndex == 2)
            location = CapRight;
        else
            location = CapMiddle;
    }
    
    if (segmentedControl.tag == SegmentControlTag2)
    {
        if (segmentIndex == 0)
            location = CapLeft;
        else if (segmentIndex == 1)
            location = CapRight;
        buttonSegmentWidth = BUTTON_SEGMENT_WIDTH2;
    }

if (location == CapLeftAndRight)
{
}


warning:the left operand of == is a garbage value

当出现这个警告(内存泄露)的时候,是由于你左边的变量在不满足上面if的条件的时候,没有给 ==左边的变量赋值,会造成这样的警告。解决办法是:可以将==左边的变量初始化一个值,或者保证 在进行if判断的时候一定有值。

你可能感兴趣的:(button)