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?
Problem with MS Visual C++?
Moderator: Board moderators
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)
-
- New poster
- Posts: 35
- Joined: Sat Jan 05, 2002 2:00 am
- Contact:
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)"C8H10N4O2 wrote:Visual C++ is nonstandard in many ways. (e.g. No min/max functions)

And obtain Compile error in OJ.
