<?= operator C++ greater less question mark equals sign

空扰寡人 提交于 2019-12-05 02:58:00
dasblinkenlight

These are GCC extensions operators. a <?= b has the same meaning as a = min(a, b) (>?= is the "max" operator), but it evaluates its left-hand side expression only once. This is not important when a is a variable, but it may make a difference when a represents an expression, especially when the expression has a side effect. For example, in

*dest++ <?= *src++;

the ++ in dest++ would be evaluated only once.

Both operators have now been deprecated.

It's a GCC extension. x >?= y is equivalent to:

x = max(x, y);

I haven't seen it used in a while though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!