Alexander Myodov <maa_public at sinn.ru> wrote: > >> "for (int i = 0; i < 10; i++)" works fine nowadays. > JC> I'm sorry, but you are wrong. The C99 spec states that you must define > JC> the type of i before using it in the loop. Maybe you are thinking of > JC> C++, which allows such things. > "gcc -std=c99" compiles the line "for (int i = 0; i <= 5; i++);" > perfectly. Along with another sample mentioned above . > To this day, I relied upon gcc in terms of standards compatibility... I misread the error message from my compiler. It /only/ works in C99 mode. Previous C standards (which CPython itself conforms to) did not allow such things. Interestingly enough, not all C++ compilers (Microsoft) hid variables created in for loops (http://www.devx.com/cplus/10MinuteSolution/28908/0/page/2). - Josiah
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4