MSVC++ 6 question

This is a discussion on MSVC++ 6 question within the C++ Programming forums, part of the General Programming Boards category; Im sure the current standard C++ states that variables declared in the initialization part of a for(; loop are local ...

  1. #1
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    MSVC++ 6 question

    Im sure the current standard C++ states that variables declared in the initialization part of a for(; loop are local only to that loop.
    But when applied to (my) MSVC++ 6, this is not the case, and the variable is within the same scope as the for(; loop.

    i.e:
    Code:
    for(int x=0;x<10;x++) cout<<x;
    cout<<++x; //x is still known up to this point
    Can anyone explain this? or is this because MSVC does not conform to the standard perhaps?
    I AM WINNER!!!1!111oneoneomne

  2. #2
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Yeah, that's one of the many problems with MSVC++ 6.0. It should be local to the loop.

  3. #3
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    one of the many problems
    For such a widely used compiler, Im surprised it has *many* more problems. lol thanks.

  4. #4
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Yeah, it's got more problems than you can imagine. Almost once a week I run into another problem with it. This morning I got fed up and started using a free compiler instead. Problem's gone! I hear that Visual C++ 7.0 has a lot of stuff fixed, but I'm not about to blow a lot of money to find out.

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Originally posted by Polymorphic OOP
    I hear that Visual C++ 7.0 has a lot of stuff fixed, but I'm not about to blow a lot of money to find out.
    Any idea when msvc 7.0 will be released ?

  6. #6
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    It IS released. Has been for a while now. It's a part of Visual Studio .NET

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Originally posted by Polymorphic OOP
    It IS released. Has been for a while now. It's a part of Visual Studio .NET
    Just goes to show how upto date Im with new software.

    Thanks for the info btw.

  8. #8
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Code:
    #define SCOPE_FIX int
    #ifdef _MSC_VER
      #if (_MSC_VER == 1200)
        #undef SCOPE_FIX
        #define SCOPE_FIX
      #endif
    #endif
    If you're using VC++ 6, and you're aiming for portability... include the above code and use SCOPE_FIX as your variable type whenever your variables would normally need to be redeclared.. like:
    Code:
    for (int i = 0; i < 100; i++)
       // ...
    
    for (SCOPE_FIX i = 0; i < 100; i++)
       // ...
    Most of the problems in VC++ 6 are due to its age... i'm pretty sure the compiler was out before the current standard was finalized.

    Also, as far as I know, the .NET command line compiler is freely availible from microsoft. I'm sure someone's build a decent IDE ontop of it, too

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM
  2. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  3. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 08:22 PM
  4. Another rather simple msvc question
    By laasunde in forum Windows Programming
    Replies: 1
    Last Post: 01-29-2003, 01:44 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21