浮动变量从上面的行中分配值 [英] Float variables assigned value from line above

查看:134
本文介绍了浮动变量从上面的行中分配值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS应用程序正在做一些对我来说不太合理的事情。我有几个浮动变量定义在我的界面,正在分配不正确。

  kettleVolume = 30; 
lbsGrain = 5;
mashIn = 65;
grainTemp = 20;

当我在调试器上进行这个操作时,我很清楚地看到下面的值被赋值 - p>

  kettleVolume float 1.09038e-33; 
lbsGrain float 30
mashIn float 5
grainTemp float 65

不知何故,他们正在从上面的线获得值?什么是我做错了?

解决方案

有很多报告,当从LLDB检查ivars他们似乎是错误的(我有同样的问题多次)。更具体地说,他们似乎正在转移。这就是说,它似乎只是XCode检查员执行过程中的一个错误。如果你想在调试器控制台中确定你的值,可以使用 GDB NSLog 它们。还有一个类似的问题在这里: GDB VS LLDB调试器


I have an iOS App that is doing things that don't quite make sense to me. I have several float variables defined in my interface that are being assigned incorrectly.

kettleVolume = 30;
lbsGrain = 5;
mashIn = 65;
grainTemp = 20;

When I step through this on the debugger, I very clearly see the following values being assigned-

kettleVolume    float   1.09038e-33;
lbsGrain        float   30
mashIn          float   5
grainTemp       float   65

Somehow, they are getting the values from the line above them? What am I doing incorrectly?

解决方案

There are numerous reports that when inspecting ivars from LLDB they seem wrong (myself had the same problem many times). More specifically they seem to be shifted. That said, it only seems to be a bug in the implementation of XCode's inspector. If you want to be sure about the values you can either po _yourivar in the debugger console, use GDB or NSLog them. There is also a similar question here: GDB Vs LLDB debuggers

这篇关于浮动变量从上面的行中分配值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆