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."

31 comments

  1. STILL no export templates? by Mik!tAAt · · Score: 4, Insightful

    Microsoft's goal is to have a 'competitively compliant' compiler - meaning it won't be 100% compliant. There are a couple of features of the ANSI/ISO standard (for instance the 'export' keyword as applied to template classes) that won't be implemented because they are considered by Microsoft to be obscure and, at this stage, theoretical.

    Somebody please explain to me why would somebody consider export templates to be 'obscure' and 'theoretical'? If export templates aren't available, you have to put most of your code in header files (or at least use your .cpp files as header files), and that IMHO is just plain stupid.

    On the other hand, aiming for STL, Boost, Blitz and Loki compliance is a Really Good Thing.

    --
    This is the place where you write something that will make you seem like a complete idiot.
    1. Re:STILL no export templates? by partingshot · · Score: 1

      > Somebody please explain to me why would
      > somebody consider export templates to
      > be 'obscure' and 'theoretical'?

      Even though its part of the standard, I'm
      not aware of any compiler that currently
      implements the 'export' keyword.

      Are you aware of any? Doesn't that pretty much
      make it 'obscure' & 'theoretical'?

      Kinda reminds me of the Knuth qoute:
      "Beware of the above code. I have only proven it correct, not tested it."

      --
      Anonymous posts are filtered.
  2. 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

    1. Re:for-loop variables by Anonymous Coward · · Score: 0

      forvar.cpp(4) : warning C4288: nonstandard extension used
      ^^^^^^

      Is that Chinese for 'foobar'? :-)

    2. Re:for-loop variables by BitwizeGHC · · Score: 2

      I think it's Finnish, actually. (Linus's metasyntactic variables?) :)

      --
      N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
  3. 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

    1. Re:for loop fix by alyandon · · Score: 1

      Are you absolutely sure that worked for you? How does disabling a compiler warning affect the for loop scoping issue?

      When I looked it up in MSDN I get the following:

      #pragma warning(disable:4127) // conditional expression is constant

  4. VC++ isn't a terrible C++ by foistboinder · · Score: 2, Interesting

    IMHO, the C++ compiler part of Visual C++ is one of the few things that Microsoft didn't totally screw up. Unfortunately it is all the other junk, like MFC and the crummy code that the IDE's wizards produce, that ruin the development environment.

    1. Re:VC++ isn't a terrible C++ by -douggy · · Score: 1

      This is true. It does produce faster code than gcc/g++ does. However I havn't tested Intels free compiler yet (which can also be used in vis studio i think...
      Free intel compiler

    2. Re:VC++ isn't a terrible C++ by statusbar · · Score: 2

      VC++ may generate fast object code, but what use is it if it can't compile your advanced c++template code?

      You are better off using the free borland C++ compiler.

      --jeff

      --
      ipv6 is my vpn
  5. templates, for-loop-scoping, etc by devphil · · Score: 4, Interesting


    Microsoft is definitely full of shit when they consider 'export' to be "theoretical" only. But implementing export is hard; witness the number of compilers that have managed to do it so far. I don't blame MS for putting it off; I blame MS for lying about their reasons for doing so. (If they'd just said, "Implementing this is a freakload of work and we'd rather point our engineers in a more revenue-profitable direction," then I could accept that, too.)

    The for-loop scoping bug has a command-line switch to toggle correct behavior. Unfortunately, with it on, large chunks of their own MFC code will no longer compile.

    Dinkumware was contracted to provide the library for VC++. They have released their own patches (freely downloadable) to the library headers. With those patches applied, your library is as ISO-compliant as it can be given the (immense) deficiencies of the compiler itself.

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

    My recommendation to others who have to work under Wintel: there are plenty of good compilers out there, and they're ALL better than VC++. Comeau, IBM, EDG, KAI, you name it...

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:templates, for-loop-scoping, etc by alyandon · · Score: 1


      The for-loop scoping bug has a command-line switch to toggle correct behavior. Unfortunately, with it on, large chunks of their own MFC code will no longer compile.

      That is currently the case with VC++ 6 (and always will be) but I believe that issue has been resolved in VC++ 7.

    2. Re:templates, for-loop-scoping, etc by lightningrod · · Score: 1

      Being a developer who sits in editors all day
      I was absolutely amazed when a workmate said to
      me that I should perhaps code my for loops differently to allow for "microsoft shitness" in the scoping of variables. Like all software this is a bug and therefore excusable. What is NOT correct in my opinion is then coding LARGE well used libraries to rely on this bug to then compile thus locking people into using an incorrect scoping method.

      This is just plain wrong imho !!

      Rod

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

    4. Re:templates, for-loop-scoping, etc by Ashran · · Score: 1

      I own that book, and it rocks!
      Another book thats damn good:
      Effective C++
      (Second Edt. Scott Meyers)

      --

      Before you email me, remember: "There is no god!"
  6. What *interview*? by BobTheWonderMonkey · · Score: 1, Interesting

    That wasn't an interview. That was Stanley's pet sycophant putting words into his mouth. ("Yessss, my preciousssss... The Stroustrapses is wanting to take away our language, preciousss...")

    I would really have liked to get a real straight answer as to VC++'s role in Microsplat's future. As it is, I'm just as confused as ever. Vague promises that it will be the power language of choice for .NET? But what is it now?

    I'll tell you what it is: it's the arcane black magic that the entire .NET system is built on! .NET is all about protecting the programmers from C++. Duh.

    I really would like to see a real interview with this guy--when he gets a grip on his task. For now, Stanley appears as confused as the rest of us.

    --
    S.
    1. Re:What *interview*? by STSeer · · Score: 1

      As to the future of C++ in MS' plans, C++ is the only low-level language Microsoft has left. Although it is pretty much useless in the .NET-Web-Service world, there are still a few people writing traditional software left... such as Quake and Office for example...

      Giving up C++ would be pretty much equivalent to giving up all future development on Office and Windows, so I bet C++ will last a long long while in the Microsoft toolbox.

    2. Re:What *interview*? by King+Of+Chat · · Score: 2

      I pretty much agree apart from one thing:

      pretty much useless in the .NET-Web-Service world

      Not so sure myself. I was working on a plan for a SOAP type web service which does a shedload of complex calculations then throws the answer back. The only way I could see to get the performance was C++. OK, in VB/C# etc. 7 there is finally some control over things like threads, but the performance isn't there.For this sort of job, I like to be able to control exactly what the machine is doing (do you believe in the Windows task scheduler?) so I can adjust for amounts of memory, number of processors etc. Whilst this isn't impossible in other languages, it is damn hard.

      Admittedly, this is an obscure example, but I'm sure there are others. If you want the performance and features of C++, then the language you want is probably ... well ... C++. Put the features into VB and all you do is make is as complex as C++ - which is not what you want for a moron's dev tool. Horses for courses.

      Oh yeah, and if anyone says that performance doesn't matter - just wait for the hardware to get faster, well you obviously don't work with actuaries. The complexity of calculations they want to do moves a lot faster than Moore's Law.

      --
      This sig made only from recycled ASCII
  7. IDE by Anonymous Coward · · Score: 0, Interesting

    Call me a heathan(sp?), but I actually _like_ the VC++ IDE

    hooking gcc up to it seems like a good idea, cuz the compiler it self sucks ass

  8. C++ Builder? by Anonymous Coward · · Score: 0

    It's interesting that in all of this no one mentions Borland's C++ Builder or their *free* Borland C++ command-line compiler. Why - or rather why not?

  9. If you're going to code for windows... by 1of9 · · Score: 1

    I'd recommend Delphi 6. Its a very nice IDE and anything you develop can be easily ported to LINUX using KYLIX..

    GO BORLAND.

    PS. I don't develop for windows anymore but I used to. I've now moved on the much lusher pastures of OS X.

  10. using g++ by Anonymous Coward · · Score: 0

    You can set Visual C++ to compile files using any external compiler that has command line compiling ability.

  11. But Visual C++ Looks so easy to use! by MulluskO · · Score: 2

    Right now I'm not using Microsoft Visual C++. I can't afford it. I do, however, want it. I really, really want it. Right now I'm using Dev C++ 4 from Bloodshed. It's open-source and free, but it can't do code completion like Microsoft can. It doesn't have those cool drop-down menus that offer you a list of all the functions in the class you just selected.


    Does anyone know of any free software that does code-completion and other time-saving features? I'd really appreciate a link, or even just a name. But I have looked, and I haven't been able to find an IDE that matched the apparent ease of MSVC. For now, I look upon my friends in envy.

    --

    Too busy staying alive... ~ R.A.
    1. Re:But Visual C++ Looks so easy to use! by alyandon · · Score: 1

      If you are that desperate for a copy the standard version of MSVC goes for a whopping $99 USD.

      I'm sure you can find copies even cheaper on ebay.

    2. Re:But Visual C++ Looks so easy to use! by fredrik70 · · Score: 1

      doesn't Quincy2000 do code completion??
      search for it on www.ddj.com, written by their c++ guy there...

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    3. Re:But Visual C++ Looks so easy to use! by Anonymous Coward · · Score: 0

      Honestly, I don't understand the need for a drop-down box with function names in it. I can type the name of the function in faster than I can lift my hand off the keyboard, move it over to the mouse, move the pointer to the cursor, scroll through the list, click, and move my hand back to the keyboard. The only thing I can think of is that it gives you some choices if you forget the name of a function.

    4. Re:But Visual C++ Looks so easy to use! by delta407 · · Score: 1

      Intellisense can be used with the keyboard alone (Ctrl-space, etc.) -- I will agree that moving my hands off the keyboard takes too long, but with this, it's impossible to forget member names and parameters (shows the param list).

    5. Re:But Visual C++ Looks so easy to use! by Anonymous Coward · · Score: 0

      That isn't the compiler - it's the IDE. Why don't you get yourself a decent programming editor? EMACS is an easy free download and there has got to be a lot of great macros available to tag your code somewhere.

      Personally, I use Visual SlickEdit - it is far more productive that the brain dead editor in VC++.

  12. WTF? by bee-yotch · · Score: 1

    You know, this is a really stupid article. slashdot's really starting to go downhill posting crap like this. And as for this screaming lunatic fellow, what kind of drugs are you on man?

  13. What is "managed C++"? by Anonymous Coward · · Score: 0

    Isn't C++ for people who want to have total control of memory management? If you want something "managed," won't you just use C#?