Page 1 of 1
Problem with MS Visual C++?
Posted: Fri Jun 07, 2002 5:49 pm
by mafattah
I have a problem with my Visual C++ compiler. The scope for a variable declared in the for statement header is not restricted to the for statement body only, but extends to the whole block of code containing the for statement. This is, of course, not standard, and makes some compile errors when I submit my programs like that.
I used some methods to override this inconsistency, but can somebody tell if it is possible to disable such a feature in Visual C++ completely?
Posted: Tue Jun 11, 2002 3:03 pm
by C8H10N4O2
Personally, I think it is poor coding style to declare variables inside the body of code. It is much better convention to declare all your variables once and then initalize when needed. From what I know, there is NO way to disable that. Visual C++ is nonstandard in many ways. (e.g. No min/max functions)
Posted: Fri Jun 21, 2002 12:42 pm
by Alexander Denisjuk
C8H10N4O2 wrote:Visual C++ is nonstandard in many ways. (e.g. No min/max functions)
Everyone can write min/max himself. But on other hand one can write in Visual C++ "const int static X" as well as "const static int" and "short int (expression)" as well as "(short int)(expression)"
And obtain Compile error in OJ.

Posted: Sat Jun 22, 2002 12:30 am
by C8H10N4O2
Compiler functions and user functions are different. For example, consider when you use operators with side-effects (e.g., ++, --).