int i and Communism
What does int i have to do with communism?
No connection? That means your coding hasn’t reached the right level. Coding is life — from coding you can experience life, and from life you can悟出 coding. That’s the realm.
Let’s see what the master Chen Rong has to say. Email excerpt:
From: xxx
Everyone please define loop variables at the beginning of the function when possible, because with definitions like: for (int i = 0; i < 10; i++) … regarding the scope of variable i, the GNU compiler considers it within the for statement, while MSVC considers it until the end of the function (MSVC seems incorrect). So I suggest extracting it and defining it separately at the top of the function.
In the history of C++ development, in 1983, C++ was once a translator, just like the CAR compiler was once a translator. C++ was translated to C, then compiled with a C compiler. The published article was “C++ as a Better C.” Parameter declarations before references didn’t have to be at the top of the function — the scope extended to the end. During translation, these definitions were moved to the front. The
int iinside for() was handled the same way, for convenience. An academic article from Bell Labs didn’t take engineering “cleanliness” too seriously. Who knew C++ would become如此成功? After that, backward compatibility became an issue — original C++ programs had to keep running. Hence the seemingly silly result.According to the ANSI C++ standard, GNU is wrong and MSVC is correct. Stroustrup originally decided this way — that i’s scope extends to the end — which caused great controversy. GNU people are “strong characters” who don’t care about standards and don’t respect the author’s intent, making this decision based on what felt “more reasonable.”
Perfection is temporary, regret is eternal. Young people追求 novelty; veterans just smile, even if they concede. This kind of trivial skill — might as well fix it when designing the next language (like designing JAVA). But these folks couldn’t invent JAVA, and they feel accomplished being able to change the scope of “i.” Childish.
The CCP entered the city and tore down Beijing’s siheyuan and city walls, thinking “upstairs, downstairs, electric lights and telephones” was communism. Now we know how ignorant we were back then, destroying thousands of years of history. Only now are we reflecting.
Without learning history, how can you understand progress? The young people of the GNU movement could learn a lot from the Chinese Communist Party, including the understanding of “freedom” and “Lei Feng.”