C/C++ 中的“-->”運算符是什麼? - What is the “-->” operator in C/C++?

問題:

After reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated , I was completely surprised that the following snippet compiled and worked in both Visual Studio 2008 and G++ 4.4.comp.lang.c++.moderated上閱讀C++/STL 的隱藏功能和comp.lang.c++.moderated ,我完全驚訝於以下代碼段在 Visual Studio 2008 和 G++ 4.4 中編譯和運行。

Here's the code:這是代碼:

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

Output:輸出:

9 8 7 6 5 4 3 2 1 0

I'd assume this is C, since it works in GCC as well.我認爲這是 C,因爲它也適用於 GCC。 Where is this defined in the standard, and where has it come from?這在標準中在哪裏定義,它來自哪裏?


解決方案:

參考一: https://stackoom.com/question/6tAK
參考二: What is the “-->” operator in C/C++?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章