Slashdot Mirror


Visual C++ and C++ Standard

Screaming Lunatic writes: "There is an interview over at codeproject about the future of C++ and .NET. Since I don't really care about .NET, the interesting part of the article is about the quest to standarize Visual C++. If you're going to code for Windows, Visual C++ is one of your few choices for a IDE/compiler combo. (Even though, if I'm not mistaken, you can hook gcc up to the IDE.) M$ seems somewhat in favor of conforming to the C++ standard, which is surprising. They talk about pushing forward with template compliance. I'm still waiting for them to get the variable declarations in for-loops right. They also claim to beat several popular compilers in compliance tests."

3 of 31 comments (clear)

  1. for-loop variables by RupW · · Score: 2, Informative

    I'm still waiting for them to get the variable declarations in for-loops right.

    If you compile with the 'disable extensions' flag, /Za, then they already do.

    Even with extensions enabled, VC++ 7 will warn when there's a conflict between extended and correct behaviours:

    forvar.cpp(4) : warning C4288: nonstandard extension used : 'i' : loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope

  2. for loop fix by cfreeze · · Score: 3, Informative

    I've dug through MSDN a while back and found this to work..

    #pragma warning(disable:4127) //Work around for broken for-scoping in VC++ 6

  3. Re:templates, for-loop-scoping, etc by UnknownSoldier · · Score: 4, Informative

    > For me the big killer is templates -- lots of failures in things like partial specialization.

    Yeah, the lack of C++ conformance in MS VC is a real pita.

    However, Modern C++ Design: Generic Programming and Design Patterns Applied by Andrei Alexandrescu has a clever sizeof() hack to work around this in VC6.

    Modern C++ Design is the most advanced C++ book out there, and EVERY C++ programmer should have this masterpiece. The perfect blend of generic programming and object orientation programming is just beautiful. (The multiparadigm support of C++ is what makes it so powerfull.)