android renderscript 源中可能有一个小错误
只是浏览 渲染脚本源。 我想我在第 36 行发现了一个错误
private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
Think that need to be a double == 但没有足够的编码经验来确定。
just looking through the source for renderscript.
I think I spotted a mistake, on line 36
private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
Think that needs to be a double == but don't have enough coding experience to be sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,我不认为这是一个错误。它根据
DEBUG
的值将LOG_ENABLED
设置为LOGD
或LOGV
。相关位是:
最后一行概念上相当于:
事实上,
实际上没有意义,因为它意味着:
它根本没有声明变量名,只是一个值应该分配给某些东西。
No, I don't think it is a bug. It's setting
LOG_ENABLED
to eitherLOGD
orLOGV
depending on the value ofDEBUG
.The relevant bit is:
and that last line is conceptually equivalent to:
In fact,
doesn't actually make sense since it means:
which doesn't have a variable name being declared at all, just a value that should be assigned to something.
这只是关于 Java 中的三元运算符如何工作的一个简单的混淆。你正在做类似的事情:
其中 b 可以是评估 true 或 false 的表达式。我曾经在第一个元素周围使用括号来清楚地表明这一点,尽管我刚刚查看了一些代码,但现在我似乎已经停止这样做了!
It's just a simple bit of confusion about how ternary operators work in Java. You're doing something like:
where b can be an expression evaluating to true or false. I used to use parenthesis around the first element to make this clear, although I just looked through some of my code and I seem to have stopped doing that now!