需要左值 [英] lvalue required

查看:116
本文介绍了需要左值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是错误消息左值需要,其实是什么意思?

what does the error message "Lvalue required" actually mean?

推荐答案

这是左值是'可分配的东西'的东西,可以在赋值的左侧出现,换句话说

An lvalue is something that can appear on the left side of an assignment, in other words 'something that can be assigned'

所以,寻找一个任务,其中左侧是不是'分配',例如,这么简单的东西可能会引发这样的错误

So, look for an assignment where the left hand side isn't 'assignable', for example, something as simple as this might trigger such an error

if (0 = foo)
{

}

在这里,你得尝试分配给一个常量,因为不小心使用=,而不是==的

Here you've got an attempt to assign to a constant because of accidentally using = rather than ==

另请参见

  • often used seldom defined terms: lvalue
  • lvalue and rvalue
  • "l-value required" error

这篇关于需要左值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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