Problem with MS Visual C++?

Post here if you don't find any other place for your post. But please, stay on-topic: algorithms, programming or something related to this web site and its services.

Moderator: Board moderators

Post Reply
mafattah
New poster
Posts: 23
Joined: Fri Apr 26, 2002 1:00 am
Location: Cairo, Egypt

Problem with MS Visual C++?

Post 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?

C8H10N4O2
Experienced poster
Posts: 137
Joined: Wed Feb 27, 2002 2:00 am
Location: Pasadena, CA

Post 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)

Alexander Denisjuk
New poster
Posts: 35
Joined: Sat Jan 05, 2002 2:00 am
Contact:

Post 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)" :D


And obtain Compile error in OJ. :(

C8H10N4O2
Experienced poster
Posts: 137
Joined: Wed Feb 27, 2002 2:00 am
Location: Pasadena, CA

Post by C8H10N4O2 »

Compiler functions and user functions are different. For example, consider when you use operators with side-effects (e.g., ++, --).

Post Reply

Return to “Other words”