I am getting the following "Passed-by-value struct argument contains uninitialized data" in the code section below:
for ( int i = 0; i < 48; i++ )
{
CGPoint posLevel;
LevelButton* pBtn;
if ( i >= 0 && i < 24 )
{
int nXX = (i % 4 + 1);
if ( i < [pBtnArray count] )
{
posLevel = ccp( (spMask.position.x - mySize.width / 2) + mySize.width / 5 * nXX,
mySize.height - mySize.height / 7 * (i / 4 + 1));
pBtn = [pBtnArray objectAtIndex:i];
if ( pBtn != nil )
{
[pBtn move:posLevel];
}
}
}
With the arrows added by xcode, if these help??

Once the commented out code is removed, there is not much code here, so I dont understand what the issue is that XCode is throwing up.
Any help in removing this error would be appreciated!
The code in your screenshot is of the form
CGRect posLevel;
if (mySize.height < 568) {
posLevel = ...;
}
if (mySize.height >= 568) {
posLevel = ...;
}
[pBtn move:posLevel];
and it seems that the static analyzer does not recognize that either the first
or the second if-block is executed in any case.
The blue arrows indicate a flow where both if-blocks are not executed,
and in that case posLevel would be undefined.
You can fix that by using if-else:
CGRect posLevel;
if (mySize.height < 568) {
posLevel = ...;
} else {
posLevel = ...;
}
[pBtn move:posLevel];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With