且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C++ 返回一个赋值?

更新时间:2023-11-09 23:48:34

在这种情况下它执行赋值,然后返回b.

In this case it performs the assignment, then returns b.

这类东西可能会被编译器标记为一个无意的错误,通常你的意思是 a == b,所以你可能需要处理它.将其作为单独的一行进行,可以清楚地表明这是有意为之.

This sort of stuff might get flagged by the compiler as an inadvertent bug, usually you'd mean a == b, so you may need to deal with that. Doing it as a separate line makes it clear it's intentional.