What is the name of the “-->” operator?(Stackoverflow)
来源:互联网 发布:2016剑三毒姐捏脸数据 编辑:程序博客网 时间:2024/06/05 07:46
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 with0
using the >
operator.
To better understand, the statement could be written as follows:
while( (x--) > 0 )
0 0
- What is the name of the “-->” operator?(Stackoverflow)
- What is the Big O analysis of this algorithm?(Stackoverflow)
- What is the use of "?
- What is the purpose of the USB?
- What is the !! (not not) operator in JavaScript?
- What Is the Purpose of This Book?
- What is the key of Data Assimilation?
- what is the use of truncate command
- What is the truth of life???
- what is the purpose of __ASSEMBLY__?
- What is The Rule of Three?
- What is the purpose of /etc/default?
- What is The Rule of Three?
- What is The Rule of Three?
- HUNNU11354:Is the Name of This Problem
- Is the Name of This Problem
- What is the main goal of the Memory Management?
- What is the cause of long acne on the nose?
- js----点击选择,再次点击取消,同时把获取的值传给后台
- POJ - 1679 The Unique MST
- Word2Vec算法和源码分析完整版
- (9 + 4 )件事助你登上职场巅峰
- UVA - 1395 Slim Span
- What is the name of the “-->” operator?(Stackoverflow)
- HDU - 4607 Park Visit
- vs2013 error C4996: 'fopen': This function or variable may be unsafe.
- java笔试题01
- leetcode Remove Nth Node from Linked List
- winform打包发布安装包详解
- 遍历交换两个数组的值
- Sicily 1404. Hie with the Pie
- Sicily 1403. Caterpillar