gpt4 book ai didi

ios - 分析器警告 : assigned value is garbage or undefined

转载 作者:行者123 更新时间:2023-11-28 20:08:24 25 4
gpt4 key购买 nike

我有一个即将完成的应用程序,在运行分析时出现以下错误:

Assigned value is garbage or undefined

错误发生在这行代码:

float flowSourceValue = flowSource[count];

当运行调试器时,代码会进入这个 for 循环并且 floatSourceValue 会被赋值。

if(gaugeReportsCFS){
count = 0;
gaugeCount = [flowKeys count];
float tally = 0.0;
float flowSource[gaugeCount];
for (NSString *key in flowKeys){
float flowSourceValue = flowSource[count]; //assigned value is garbage or undefined
if(flowSourceValue < 1){
gaugeReportsCFS = NO;
gaugeReportsFeet = YES;
} else {
if(!isnan(flowSource[count])){
flowSource[count] = [[rvrGauge.gaugeFlowList objectForKey:key] integerValue];
tally += flowSource[count];
}
}
count++;
}
}

我收到此警告的原因可能是什么?谢谢!

最佳答案

本地数组

 float flowSource[gaugeCount];

未初始化,因此可能包含“垃圾”。访问它是未定义的行为。

关于ios - 分析器警告 : assigned value is garbage or undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21191194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com