Question:

After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that it compiled and worked in both Visual Studio 2008 and G++ 4.4.

The code:

#include <stdio.h>
int main()
{
int x = 10;
while( x --> 0 ) // x goes to 0
{
printf("%d ", x);
}
}

I'd assume this is C, since it works in GCC as well. Where is this defined in the standard, and where has it come from?

Answer:

That's not an operator -->. That's two separate operators,
--
and >.

The condition code is decrementing x, while returning x's original (not decremented) value, and then comparing the original value with
0 using the > operator.

To better understand, the statement could be written as follows:

while( (x--) > 0 )

What is the name of the “--&gt;” operator?(Stackoverflow)的更多相关文章

  1. The Safe Navigation Operator (&.) in Ruby

    The most interesting addition to Ruby 2.3.0 is the Safe Navigation Operator(&.). A similar opera ...

  2. Blender 脚本之 Operator 初探

    addon(插件)用来扩展 Blender 的功能,跟其他软件里的 plugin(插件)一样,去掉不会影响软件的运行.插件可以加到 Blender 的用户偏好设置目录里,或者就在你所编辑的.blend ...

  3. Sequence Project Showplan Operator 序列映射运算符

    Sequence Project Showplan Operator 序列映射运算符 序列映射运算符会从一个已经排序的集合里通过不停添加集合里的列执行计算. 运算符根据一个或多个列的值把输入集合分为多 ...

  4. [c++] Operator overloading

    c++的操蛋属性:自己为一档,空一档,其他随意. UB_stack a; UB_stack b = a; // copy auto c = a; auto d {a}; // (or auto d = ...

  5. EC笔记:第二部分:11:在operator=中处理“自我赋值”

    已经一年半没有写过博客了,最近发现学过的知识还是需要整理一下,为知笔记,要开始收费了以前写在为知笔记上笔记也会慢慢的转到博客里. 话不多说,进入正题. 考虑考虑以下场景: 当某个对象对自身赋值时,会出 ...

  6. Swift学习(一):自定义运算符 operator

    自定义运算符仅能包含这些字符: / = - + * % < >!& | ^.~ 运算符位置: 前置运算符 prefix 中间运算符 infix 后置运算符 postfix 运算符其 ...

  7. Bash 4.4 中新增的 ${parameter@operator} 语法

    Bash 4.4 中新增了一种 ${...} 语法,长这样:${parameter@operator}.根据不同的 operator,它展开后的值可能是 parameter 这个参数的值经过某种转换后 ...

  8. 为什么operator>>(istream&, string&)能够安全地读入长度未知的字符串?

    一般而言,实现"读入用户输入的字符串",程序中自然不能对用户输入的长度有所限定.这在C++中很容易实现,而在C中确没那么容易. 这一疑问,我在刚学C++的时候也在脑中闪现过:不过很 ...

  9. tensorflow添加自定义的auc计算operator

    tensorflow可以很方便的添加用户自定义的operator(如果不添加也可以采用sklearn的auc计算函数或者自己写一个 但是会在python执行,这里希望在graph中也就是c++端执行这 ...

随机推荐

  1. MySQL+Toad for Mysql安装,配置及导入中文数据解决乱码等问题

    1.下载MySQL5.7版本,安装官网上的windows安装版,下载地址为:https://dev.mysql.com/downloads/windows/installer/5.7.html 安装选 ...

  2. with 重写enter exit 方法

  3. Ucinet6 + Netdraw 根据excel文件绘制网络拓扑图

    条件: 具备Ucinet6 和 Netdraw 两款软件的Windows excel文件格式(.xlsx  .xls  .csv):必须是数字,如果现有的文件不是数字,可以采用某种编码的方式将其映射成 ...

  4. xpath-helper: 谷歌浏览器安装xpath helper 插件

    1.下载文件xpath-helper.crx xpath链接:https://pan.baidu.com/s/1dFgzBSd 密码:zwvb,感谢这位网友,我从这拿到了 2.在Google浏览器里边 ...

  5. 收缩自编码器(CAE)

    自编码器是一种很好的降维技术,它可以学习到数据中非常有用的信息.而收缩自编码器作为正则自编码器的一种,其非线性降维效果非常好,并且它的过程可以通过流形知识来解释. 基础知识 1.自编码器 自编码器是一 ...

  6. RabbitMQ 初学及其深入学习推荐的一些文章

    记录一下学习RabbitMQ过程中,收获比较大的一些文章: 什么都别说,先把这6个Demo 玩一遍 https://www.rabbitmq.com/getstarted.html 大佬1号 http ...

  7. Luogu2570 [ZJOI2010]贪吃的老鼠 ---- 网络流

    Luogu2570  [ZJOI2010]贪吃的老鼠 题面描述 https://www.luogu.org/problemnew/show/P2570 然后题意大概就是m只老鼠,然后吃n个奶酪,已知 ...

  8. BZOJ.1070.[SCOI2007]修车(费用流SPFA)

    题目链接 /* 神tm看错题*2.. 假如人员i依次维修W1,W2,...,Wn,那么花费的时间是 W1 + W1+W2 + W1+W2+W3... = W1*n + W2*(n-1) + ... + ...

  9. 如何使用PowerDesigner设计数据库关系模式

    /*==============================================================*/ /* DBMS name: Microsoft SQL Serve ...

  10. Linux 标准目录结构 FHS

    因为利用 Linux 来开发产品或 distribution 的团队实在太多了,如果每个人都用自己的想法来配置文件放置的目录,那么将可能造成很多管理上的困扰.所以,后来就有了 Filesystem H ...