奇怪的使用条件运算符(>?=) [英] Weird usage of conditional operator (>?=)

查看:151
本文介绍了奇怪的使用条件运算符(>?=)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看一些代码,看到这样的:

I was looking at some code and saw something like this:

int d = 1;
int somethingbigger = 2;

d >?= somethingbigger;

cout << d << endl;

我认为这应该输出2.但是我甚至不能用gcc 4.5.2编译。
代码是在2005年编写的,并用gcc 3.4.4(不是100%确定)编译。

I think this should output 2. But I can't even compile this with gcc 4.5.2. The code was written in 2005 and compiled with gcc 3.4.4 (not 100% sure).

有人可以解释这是如何工作的,

Can someone explain how this works and why I can't compile this with a recent compiler.

推荐答案

这是最大赋值运算符,a GCC扩展

This is the "maximum" assignment operator, a GCC extension.


  • 如果未启用扩展程序,则您将无法使用此功能。

  • If the extension is not enabled, then you will not be able to use this feature.

同4.0.1版本


G ++最小和最大运算符<?>?及其
复合形式(<?= )和>?= )已被弃用,并且将在未来版本中删除
。使用这些运算符的代码应该
修改为使用std :: min和std :: max。

The G++ minimum and maximum operators (<? and >?) and their compound forms (<?=) and >?=) have been deprecated and will be removed in a future version. Code using these operators should be modified to use std::min and std::max instead.


  • 它看起来像他们走了4.0.4

    这篇关于奇怪的使用条件运算符(&gt;?=)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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