Slashdot Mirror


Migrating from MSVC 6.0 to Studio 2005?

greywar asks: "While the preferred method would be simply use Linux, unfortunately my company is using Microsoft Visual Studio 6.0 with C++. I have been asked to recomend if we should upgrade to the new upcoming visual studio 2005. Has anyone got any real life experience with moving a project of about 220,000 lines of code, 60,000 lines of comments from the old MSVC to the new Studio 2005 which is currently in Beta? What benefits are there, and what things do we lose? What problems will occur?"

130 comments

  1. what? concerns about MS compatibility? by yagu · · Score: 3, Funny

    I'm pretty sure your 60,000 lines of comments will port to the new environment okay. (But I actually have an example of where they didn't.)

  2. real life experience? by Yogurt+Earl · · Score: 2, Funny

    real life experience?

    Nope, only work related experience.
    Sorry I couldn't help.

  3. IDE is Beautiful by Anonymous Coward · · Score: 0

    Love Microsoft or hate Microsoft ... their IDE has evolved incredibly well. I haven't tried Visual Studio 2005 yet, but 2003 is really well done for Windows development. I think minimally you'd see a productivity boost from that alone.

    1. Re:IDE is Beautiful by SoCalChris · · Score: 4, Informative

      We're using VS2005 for the development of our next gen software here at work (C# though, not C++). VS2005 offers a lot of improvements in the IDE over VS2003, which itself was a huge improvement over the VS6 IDE. Go ahead and try installing VS2005, like the parent poster said, you will likely see large gains in productivity just because of the new IDE and debugging tools available.

    2. Re:IDE is Beautiful by drakaan · · Score: 1
      Gonna have to go ahead and disagree with you on that one. The VS.Net IDE worked so much differently from previous versions that it slowed me down a fair bit (habits and all, I guess).

      Then, of course, there's the fact that a fair number of methods and common constructors from VB6 don't get translated automatically (you'll find out all about this if you have any code that touches any system logs).

      I'd say that much code going from VS6 to VS2005 is going to be a rather large pain in the ass, unless Microsoft has made some serious improvements to their project upgrade wizards.

      --
      "Murphy was an optimist" - O'Toole's commentary on Murphy's Law
    3. Re:IDE is Beautiful by ncmusic · · Score: 1

      The poster didn't mention anything about VB6. So your point is moot. Anyone writing VB6 code will have to port their application to VB.net. This is not required for C++. Though if they are making extensive use of MFC there maybe some things that have changed (likely for the better).

    4. Re:IDE is Beautiful by forkazoo · · Score: 2, Informative

      On the subject of debugging tools, does 2005 come with a profiler? I'm told 6 did. I know 2003 did not. It greatly disappointed me, because I have grown otherwise quite fond of the IDE. It has some strangeness, but is pretty decent for the most part. (One example of the strangeness is that I have to build my app as a multithreaded DLL or else I have problems. I'm sure a VC guru would spot the issue in a heartbeat, but I am thoroughly confused about it, and gave up researching the issue. It's an executable, not a DLL...)

      P.S. I discovered that AMD has a free profiler for download. It works great with VS.NET ! :)

    5. Re:IDE is Beautiful by cookd · · Score: 2, Informative

      Yes. I was happy to see it come back. Great profiler with code coverage and everything.

      --
      Time flies like an arrow. Fruit flies like a banana.
    6. Re:IDE is Beautiful by drakaan · · Score: 1
      No, he didn't mention anything about VB6, true. The problem with that being that the article was about migrating from VS6 to VS2005.

      Actually, anyone writing VB6 code probably *doesn't* have to port their code to VB.Net, since that code runs just fine on NT, Win2K, WinXP/XP Pro, and Server 2003. We know that the article author needs to, which is the reason for his/her question.

      For trivial apps (where you don't do MFC or windows API-level stuff), it's not a tough transition, but from the sounds of the size of the codebase, I'm guessing the author of the article is going to run into a few headaches.

      If I ask you "Hey, will it be tough to go from VS6 to VS2005?" and you reply "No, it's easy to go from VS2003 to VS2005", I certainly hope I get additional input (since my question wasn't answered in a useful way).

      I call your criticism and raise you one ;)

      --
      "Murphy was an optimist" - O'Toole's commentary on Murphy's Law
  4. .Net 2 by Fr05t · · Score: 3, Informative

    Not sure if this is an issue still (from what I read it didn't seem like MS was going to change it), or even for you.

    Several months ago the beta wasn't able to compile .NET 1.0/1.1 - 2.0 only.

  5. Comments are for wimps. by Anonymous Coward · · Score: 2, Funny


    grep -v -e "^\/\/" oldfoo.c > newfoo.c

    1. Re:Comments are for wimps. by Anonymous Coward · · Score: 0

      very_important_function_call();  // if you don't call this nothing works

    2. Re:Comments are for wimps. by Anonymous Coward · · Score: 0

      He included a ^ to indicate start of line.

  6. Very poor by feebdaed · · Score: 5, Informative

    My last experence with VS 2005 was very poor. The IDE itself may be ok, but the real problem lies with the C++ compiler.

    On a project roughly the same size as yours. Moving from VS 2003 to VS 2005 generated 400+ compiler errors and thousands of warnings. This is up from 0 errors and 0 warnings with VS 2003 and g++.

    The problem is one of lockin. MS depricated ALL of the C standard library. Every strlen() is now a compile error. Best of all the only documented way to enable the old functionality (some obscure #pragma) was broken.

    1. Re:Very poor by Keith+Russell · · Score: 2, Insightful
      The problem is one of lockin. MS depricated ALL of the C standard library. Every strlen() is now a compile error. Best of all the only documented way to enable the old functionality (some obscure #pragma) was broken.

      Are you sure that wasn't just early-beta cruft? Microsoft has been making a push for C and C++ standards compliance with VS2k3 and 2k5. And if functions like strlen() are failing, I doubt Microsoft would be able to use the compiler as dogfood.

      --
      This sig intentionally left blank.
    2. Re:Very poor by frank2 · · Score: 1

      No, there's another way around that. Set the compiler to ignore those warnings. I don't have VS2005 available right now, but I just did it last night on a newly converted project.

    3. Re:Very poor by Hard_Code · · Score: 1

      The problem with VS 2003 is that the warning levels are very coarse grained. You either get nothing, or an avalanche of both trivial and non-trivial warnings. Maybe in 2005 the default is just stricter. And is strlen() deprecated in favor of something like strnlen, or is it just deprecated with no replacement?

      --

      It's 10 PM. Do you know if you're un-American?
    4. Re:Very poor by bushidocoder · · Score: 5, Informative
      Functions like strlen have been depricated - in fact, Microsoft depricated most of the standard C library in favor of what they call the "Safe C libraries" which simply replace strlen with range limitted functions like strnlen. Its a pain in the butt to move, but honestly, its a good idea.

      Using the old functions generates a compiler warning that you are linking against the old unsafe libraries. It should only generate an error if you have signalled the compiler to treat warnings as errors. You can suppress the warnings and ignore them, or leave them in place and slowly migrate your code to the safer runtime library. That said, there are a few compiler errors (especially related to scope of variables on the stack) you can get now as they tightened up their standards a bit.

    5. Re:Very poor by thsths · · Score: 2, Informative

      > And is strlen() deprecated in favor of something like strnlen, or is it just deprecated with no replacement?

      How is strnlen() a replacement for strlen()? Sure, if you have fixed length storage, it may do, but for dynamic strings it just doesn't work. Plus strnlen() is not conforming to any standard, so you cannot rely on the behaviour being portable.

    6. Re:Very poor by ckelly5 · · Score: 3, Informative

      I'd also like to add to this that if you read the msdn article "Saying Goodbye to an old friend", Microsoft has submitted the new "safe" methods (called "strsafe functions") to the C/ C++ standards committee to have them included in future versions of C++

      "say goodbye":
      http://msdn.microsoft.com/library/default.asp?url= /library/en-us/dncode/html/secure03102004.asp

      more info on strsafe.h (included in the VC.NET 2003 SDKs and up):
      http://msdn.microsoft.com/library/default.asp?url= /library/en-us/dnsecure/html/strsafe.asp

    7. Re:Very poor by Anonymous Coward · · Score: 0

      DEPRECATE!!!

    8. Re:Very poor by Anonymous Coward · · Score: 2, Interesting

      You're coding in Visual Studio, to paraphrase: "We don't need no steenking portability!"

    9. Re:Very poor by jmccay · · Score: 2, Informative

      I find that funny. I just compiled a short sample using VS 2005 Beta 2 team edition with no problems using strlen. I think the string.h versions were deprecated, but cstring header should not be considering it is a part of the standard. I tried both cstring & string.h. What version of the beta do you have.

      --
      At the next eco-hypocrisy-meeting, count the private jets used to get to the meeting. Should be interesting to see that
    10. Re:Very poor by cookd · · Score: 1

      Actually, you can do whatever you want with the warnings.

      Every warning has a default level, either "error", "1", "2", "3", "4", or disabled. You can change the level of any warning. You do this via #pragma warning. Typically, you will create a customized "warning.h" file that has all of your warning settings, and you will include it into your compile with the /FI(file) command line option.

      Like a warning? Promote it to level "1" or make it an error. Don't like a warning? Make it level "4" or disable it.

      FYI, here's how we have it set up for our builds:

      We normally build with /W3 (warnings at level 3 or less are enabled) /WX (any warning is treated as an error). When we upgrade compilers, we remove /WX until we've cleaned up all new warnings, then put it back. In a few cases where we have generated code (such as code created by MIDL or LEX/YACC) that doesn't compile at /W3, we compile at /W2 instead.

      Most warnings are fine at the default Visual C++ level. A few are adjusted up or down in our warning.h file.

      All warnings that should never ever ship are set as errors. This way, even during the short times when /WX is not applied to our build, we still won't let any serious issues into the code.

      Warning level 1 is for "transitional" warnings -- warnings that I want to upgrade to "error" ASAP, but can't yet because we still have a few of them in the codebase. (Currently: None in this category. Yay!)

      Most warnings go in level 2.

      Warning level 3 is reserved for warnings that appear in generated code. MIDL, LEX, and YACC are allowed to trigger these warnings, but nobody else is.

      Warning level 4 is for "lint" type warnings -- things that the developer might want to see, but aren't always bad. We provide a build option that allows a developer to rebuild their code at /W4 and with "warning-as-error" disabled as a kind of "lint" check.

      Warnings that are simply stupid are disabled. (Currently: None in this category that weren't disabled by default by VC. Yay!)

      --
      Time flies like an arrow. Fruit flies like a banana.
    11. Re:Very poor by Kawahee · · Score: 1

      No, you have to enable linking to the old libraries using the Tools -> Options -> Folders thing, do libraries, and point it to the Platform SDK ones. Then you'll have good ol' c/c++ and win32. It was a feature left out in the early .NET 2005 Beta's that really pissed me off.

      --
      I'll subscribe to Slashdot when I see a month without a dupe, a typo, or an article the "editors" didn't read.
    12. Re:Very poor by Anonymous Coward · · Score: 0
      Psst, push CTRL+W

      OK, I'm back now. Are you happy!!!

      frikken *kidde

    13. Re:Very poor by Kawahee · · Score: 1

      Woa Woa Woa, let's not go nuts here. Is it my fault you haven't memorised the common keyboard translators for Windows?

      --
      I'll subscribe to Slashdot when I see a month without a dupe, a typo, or an article the "editors" didn't read.
    14. Re:Very poor by RupW · · Score: 1

      The problem is one of lockin. MS depricated ALL of the C standard library. Every strlen() is now a compile error. Best of all the only documented way to enable the old functionality (some obscure #pragma) was broken.

      Uh, no, it's a define: _CRT_SECURE_NO_DEPRECATE. The warning message actually tells you that. Or at least it does in beta2 and beyond.

      And it's not necessarily lockin: MS have proposed the *_s versions to the C committee, I think.

    15. Re:Very poor by Anonymous+Brave+Guy · · Score: 1

      It's strange that you have that experience, because we've ported several code bases of comparable size to the beta with no such difficulties. It took a few minutes to deal with warnings about deprecated functions, but there weren't many since in C++ there aren't many reasons to prefer C-style strings over a decent class anyway.

      What were the errors you saw?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    16. Re:Very poor by bushidocoder · · Score: 1
      If you think my spelling of the word is off, you should hear how I always mangle it when I pronounce it.

      Thanks for correcting me, though - one day I'll finally get it right.

    17. Re:Very poor by jgrahn · · Score: 1
      Are you sure that wasn't just early-beta cruft? Microsoft has been making a push for C and C++ standards compliance with VS2k3 and 2k5. And if functions like strlen() are failing, I doubt Microsoft would be able to use the compiler as dogfood.

      Of course, if we're talking C++, strlen() is obsoleted in favor for std::strlen(const char *).

      And by the way, marking std::strlen as unsafe by default is moronic. It is safe; you just have to know a bit about its argument. Like, that it actually is a string ...

  7. Should you upgrade? by Threni · · Score: 1

    Don't you have to upgrade to Visual Studio .NET to use the more recent DirectX SDKs? Is your case any different?

  8. Re:Huh? by Anonymous Coward · · Score: 0

    Intel should be avoided at all cost, as they purposely screw cause problems for AMD CPU's. And to think, this is _THE_ compiler I bought for MYSELF for my AMD machines before I found this out. Never again.

  9. Painful by 0kComputer · · Score: 2, Informative

    if 6.0 to 2003 is any indication Get ready for a lot of manual header adding. To convert, I had to create fresh ATL projects and re add all my header files because VS 2005 doesn't recognize the dsw. Kind of a pain in the ass, and, I cant really think of any benifits attained from doing it. If you're just coding w/ C/C++ id stick to 6.0. If you are trying to migrate to .net/c#, well I guess you'll have to go through this sooner or later.

    --
    Top 10 Reasons To Procrastinate
    10.
    1. Re:Painful by Profound · · Score: 1

      If you judge a compiler by how it upholds language standards (builds legitimate C++ code, STL implementation etc) then MSVC++ 6.0 is terrible.

      Google for "enum hack" (static const int foo = 42; doesn't work in a header file.) to learn about the fun of writing workaround code to get around MSVC++ 6.0s deficiencies.

    2. Re:Painful by UnknownSoldier · · Score: 1

      ] if 6.0 to 2003 is any indication Get ready for a lot of manual header adding.

      Work smarter, not harder.

      i.e. There are utils/macros to do that, specfically, you'll want to check out...

      1. Project Converter
      2. .NET 7 <--> .NET 7.1

      --
      If the Bible is infallible, which version would that be?

  10. One Tip... by GypC · · Score: 4, Funny

    ... before moving your production code to any environment that is still in beta, you must destroy all of your backups.

  11. Experience with .NET by Anonymous Coward · · Score: 4, Informative

    Our code base is about 1M lines of C++ code + comments. We support production builds on MSVC6 and Linux (gcc 3.2) and solaris. We recently started building in .NET 2003. Apart from issues that we already confronted when porting to Linux (we had previously has some code using old iostreams, no longer supported after VC6), we had no siginificant porting issues. One issue that we have not yet solved is that link times are much worse, particularly when building against debug libraries. This is the main thing keeping us from moving to .NET for our production builds. We are hoping the situation improves with 2005, and if so may leap frog over 2003.

    1. Re:Experience with .NET by KMAPSRULE · · Score: 1

      Have you tried using precompiled headers for the VS Build ??
      Cut our build and link times down by a huge percentage for a 500,000+ SLOC cross compiled project
      (linux-gcc) and MSVC++ 2003.NET
      I havent looked at precompiled headers for the Linux build but on the Win32
      side of things it helped a lot
      nice article here

      --

      --Im an oven mitt, not an engineer! (SLArbys Radio Commercial)
    2. Re:Experience with .NET by cookd · · Score: 1

      This usually is from Link-Time-Code-Generation. This is a nifty optimization that can make a big difference in some cases, but it makes linking take a lot longer.

      Remove the /GL flag from the compile, and remove the /LTCG flag from link. Your build times should go down significantly.

      --
      Time flies like an arrow. Fruit flies like a banana.
  12. Some unfixed bugs still ... by twoflower · · Score: 4, Funny
    What problems will occur?
    Make sure you read KB3090309, "KNOWN ISSUE: Earth crashes into Sun" before upgrading.
    --


    --
    Twoflower
    1. Re:Some unfixed bugs still ... by Anonymous Coward · · Score: 0

      Google provides no response to this KB article. Clearly there are no such things as a "sun" or an "earth", and most certainly if the two did exist in fiction they would never "crash".

    2. Re:Some unfixed bugs still ... by OldManAndTheC++ · · Score: 1

      Haven't run into that one yet, but it's comforting to know there's a backup, even if we have to call Magrathea to get access...

      --
      Soylent Green is peoplicious!
  13. You should be fine.. by parryFromIndia · · Score: 4, Informative

    In my experience MS cares a lot about backwards compatibility. So if you used standard C++ code (may be with some anti-standards tweaks to get the VC++ 6.0 compiler work - it's a shitty compiler when it comes to C++ standards compliance) you should be fine. The APIs are still there, albeit some are now deprecated like the unsafe string handling functions - Your code will still compile but with warnings.
    Needless to say your projects will be converted automatically.
    And you might want to clean up the code of any VC6 compiler specific kludges as the VS 2005 C++ compiler is nearly perfect when it comes to C++ standards compliance.
    If you are using any 3rd party libraries compiled with VC++ 6.0 you might need to get an updated version compiled for VS2005. I found it problematic mixing C++ libraries compiled by VC6 and VC7, for example.

    1. Re:You should be fine.. by abradsn · · Score: 1

      Please mod parent up. These are the issues you should consider.

  14. Sloppy Programming will cause issues by KMAPSRULE · · Score: 3, Informative
    We Did a test run of a project roughly Twice your Stated Size from VS2003.NET to 2005.NET and The main issues that cought us were the Company we inherited the project from had very poor Programming practices (Going From VC6 to 2003.Net was a nightmare due to their sloppiness)

    so things like this (which you shouldnt be doing anyway):
    {

    for (int i=0; i< someLimit; i++)
    {
    doSomething(i);

    }

    for (i=0; i< someLimit2; i++)
    {
    doSomething2(i);

    }
    }
    Wont Work Anymore
    Several deprecation issues but overall it was a fairly smooth transition, but for us we already suffered and bled going from VC6 to 2003.NET
    --

    --Im an oven mitt, not an engineer! (SLArbys Radio Commercial)
    1. Re:Sloppy Programming will cause issues by frank2 · · Score: 1

      There's nothing wrong with that code, although I personally would try to avoid writing like that too. But there _IS_ a thing called "scope" in C/C++ which allows it. Older M$ compilers didn't understand scope properly though, and this caused big problems. There is an option in VS2005 to enable/disable scope enforcement though (sorry - don't have VS2005 available in front of me to check out where it's located at).

    2. Re:Sloppy Programming will cause issues by KMAPSRULE · · Score: 1

      Yeah ... there were _HUGE_ blocks of code in the application that we inherited that pretty much ignored scope
      MVSC++ 6.0 let most of it slide, bit us hard when we took it to 2003 .NET and there were a few places that had wacky scoping that
      didnt cause an issue till we tried 2005. NET, we are still aways away from transitioning from 2003.NET but if the previous owners of the Code had
      tried to follow the standards and had followed good coding practices there wouldnt have been as many issues when we compiled with Scope enforcement on :)

      --

      --Im an oven mitt, not an engineer! (SLArbys Radio Commercial)
    3. Re:Sloppy Programming will cause issues by ConceptJunkie · · Score: 2, Interesting

      The problem is the compiler, not practice.

      If you do a lot of loops, it makes sense to reuse the "i" variable, since it's been a standard iterator name since the days of Fortran in the 60's.

      The old compiler (VC6, which I use by the way) didn't recognize variables declared in the for clause as existing only within the scope of the for loop.

      So what do you do?

      1. Use a different variable name for each loop. Granted sometimes this makes sense. I find myself more and more using short descriptive names anyway, but forcing yourself to use a new variable name for each loop is annoying and yet another in a list of hundreds of ways Microsoft makes you work for their tools rather than the other way around. Or worse, you put extra braces around eacf for loop. All ugly and clumsy, but then again if you've ever seen what ClassWizard does to your code or used AppStudio generated code you know that MS seems to think code needs to look like goat spew.

      or

      2. Do exactly what you describe, and reuse i over and over even though it's incorrect. What's worse is if you wanted to write code that would work in both versions. Either you have to go through the pointless exercises above, or some other ugly kludge, or you have to disable the proper scoping in the newer compiler. It's messy and ugly either way.

      Finally, I'd be mroe than happy to consider upgrading to something newer than VC6, but none of clients have ever wanted to. They insist on staying with the tried and true, and I'm not going to argue because that's perfectly fine with me.

      --
      You are in a maze of twisty little passages, all alike.
    4. Re:Sloppy Programming will cause issues by Rufus88 · · Score: 2, Insightful
      So what do you do?
      1. Use a different variable name for each loop. [...]
      2. Do exactly what you describe, and reuse i over and over even though it's incorrect.
      And what, pray tell, is wrong with doing it the valid, old-fashioned way? I.e.:
      int i;
      for (i=0; i<MAX_A; i++)
      {
      do_something(i);
      }
      for (i=0; i<MAX_B; i++)
      {
      do_something_else(i);
      }
    5. Re:Sloppy Programming will cause issues by Rufus88 · · Score: 1

      There's nothing wrong with that code,[...]

      You mean, other than using a variable outside its scope?

    6. Re:Sloppy Programming will cause issues by ConceptJunkie · · Score: 1

      Duh. Nothing. I'm so used to declaring in the for loop I didn't even consider the goold old C way.

      Duh.

      --
      You are in a maze of twisty little passages, all alike.
    7. Re:Sloppy Programming will cause issues by Henry+V+.009 · · Score: 2, Insightful
      That's great as long as things don't get complicated. Declaring i in the outer scope like that is a temptation to use it in that outer scope. (Like not declaring things const.) For example, what if you have this:
      int i;
      for (i=0; i<MAX_A; i++)
      {
      do_something(i);
      if (condition) break;
      }
      ...
      if (i==...) {...}
      No problem, right? But say a year later, you come along and find that you need to modify your code to something like this:
      int i;
      for (i=0; i<MAX_A; i++)
      {
      do_something(i);
      if (condition) break;
      }
      ...
      for (i=0; i<MAX_B; i++)
      {
      do_something_else(i);
      }
      ...
      if (i==...) {...}
      Oops!
    8. Re:Sloppy Programming will cause issues by cookd · · Score: 1

      People seem to forget that you can create scopes at will.

      void myfunc()
      {
          { // Scope for the "i" variable.
              for (int i = 0; i < 10; i++)
              {
                  ...
              }
          }

          { // Scope for the "i" variable.
              for (int i = 0; i < 10; i++)
              {
                  ...
              }
          }
      }

      --
      Time flies like an arrow. Fruit flies like a banana.
    9. Re:Sloppy Programming will cause issues by ConceptJunkie · · Score: 1

      Actually, I mentioned that, but don't like it because it's just more clutter. You're still working for the compiler rather than the other way around.

      I think it all boils down to a short-sighted (at least in hindsight) choice made by the implementors of the original C++ compilers and wasn't corrected until the standard was actually passed and people like Microsoft made a concerted effort to follow the standard to the fullest. From what I've heard VC++ 2003 is among the best, if not the best, at fully and correctly implementing the ANSI standard and MS deserves a big thumbs up for this. (Hey, gotta toss 'em a bone once in a while, they do occasionally do things really well.)

      It was certainly interesting in the "bad old days" when no two compilers implemented things like templates the same way. Of course, I'm no fan of templates, since they are essentially a kludge to work around the fact that there are atomic variable types that are not part of the OO implentation in C. If there were some abstract type from which int, char, etc, were derived then templates would be unnecessary. In other words, templates only exist because C++ isn't fully OO.

      Of course, then we wouldn't have "template metaprogramming" and there would be a whole bunch of computer geeks who would have to stop writing papers and articles showing us how smart they are implementing the Sieve of Eratosthanes that prints prime numbers in compiler warnings, and get back to doing useful work. :-P

      --
      You are in a maze of twisty little passages, all alike.
    10. Re:Sloppy Programming will cause issues by Kosgrove · · Score: 1

      It's bad practice to reuse the variable. (I'm sure many books have reiterated this, but Code Complete by Steve McConnell comes to mind as a place where I definitely remember reading this.) Performance-wise, it will not make any significant difference, but in terms of readability and correctness, if those loops are 40 lines apart, you're going to have a tougher time debugging and a much greater risk of making a logical error. The best practice is to declare a variable right before it's used, and to use it once and only once.

    11. Re:Sloppy Programming will cause issues by RupW · · Score: 1

      The old compiler (VC6, which I use by the way) didn't recognize variables declared in the for clause as existing only within the scope of the for loop.

      This is a documented Microsoft syntax extension. You can disable it with /Za.

    12. Re:Sloppy Programming will cause issues by Haeleth · · Score: 1
      Okay then,
      for (int i = 0; i < MAX_A; ++i) {
          do_something (i);
          if (condition) break;
      }
      /*...*/
      for (int i = 0; i < MAX_B; ++i) {
          do_something_else (i);
      }
      100% standards-compliant C++, and no risk of using i outside the loop. What's the problem?
    13. Re:Sloppy Programming will cause issues by Henry+V+.009 · · Score: 1

      Exactly so. Your code is the proper way to do it. I was replying to: "And what, pray tell, is wrong with doing it the valid, old-fashioned [C not C++] way?" My above code illustrates exactly what is wrong with the C way.

      The only real issue left with the proper C++ way (that you illustrate) is that VC6 was broken, and a good portion of the world's C++ code couldn't use it.

    14. Re:Sloppy Programming will cause issues by Anonymous+Brave+Guy · · Score: 1

      Unfortunately, if you do, large numbers of popular Windows-based libraries stop working: MFC, for instance. :-(

      By default it's broken in VC++ 7 as well, but you can at least disable it in isolation there with /Zc:forScope.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    15. Re:Sloppy Programming will cause issues by ConceptJunkie · · Score: 1

      What's the problem?

      MSVC6 will claim that i is declared twice. That's what we are talking about. There doesn't seem to be a good way to handle this for code that is compiled under the old bad way and the newer good way of interpreting scope for the for loop variables.

      I have a huge library of code that I use with MSVC++6. Some day I imagine a client will actually want to use VC2003 or newer (hasn't happened yet). I'd rather use the new style as it is (and always has been) the correct implementation for C++, but if I need to go back to VC6, then the code won't compile.

      You could turn off the newer, correct interpretation in VC2000+, but that's just as bad since you are deliberately breaking the language and perpetuating a mistake that was made a decade or more ago. I remember reading Stroustrop's comment that it was wrong, but most compilers at the time implemented scope the way VC6 does. After some consideration I realized his way was best, but there wasn't anything I could do, at the time.

      It's really a bit of an ugly situation for those of us who always declared loop variables in the loop, and want to continue to support a development environment that is still used by about half the Windows programmers. Face it, MS mostly got it right with VC6, and just like with OS's and Office, for most people they ran out of reasons to make them upgrade.

      --
      You are in a maze of twisty little passages, all alike.
  15. Migration Problems by megaversal · · Score: 2, Insightful

    I've had lots of various problems with small projects. What I've learned to do is port a few things at a time, especially if you have a lot of libraries and other things, you can try porting over a library and fix that up to keep running with other VS6.0 stuff while you slowly move it all over.

    Of course the fun one would be download the trial beta and take a copy of all the code, build it, and see how many errors you get (hint: it will probably be a lot).

    --
    Sig!
  16. Go for it by frank2 · · Score: 5, Informative

    Our company's main product currently has around 1.9 million lines of code. I've been running the beta compiler for months, and have found excellent performance gains over our normal builds which are created with VC6. Generally, I'm seeing execution times of around 2/3 of what they were before. This is on P4's, Athlons, and AMD-64's.

          I had no trouble converting my projects from VC7 to the Beta, and I presume the VC6 to Beta would work well too. There will be a ton of warnings at first about deprecated functions like strcpy, but you can easily tell the compiler to ignore those (or use the new M$ functions if that's your style).

          There are tons of new features that I haven't had a chance to use yet, but am looking forward to trying (like OpenMP).

          And yes, this endorsement even comes from someone who in general is VERY anti-M$.

    1. Re:Go for it by Anonymous Coward · · Score: 0
      And yes, this endorsement even comes from someone who in general is VERY anti-M$

      Noooo, really? I'm shocked. Shocked!

  17. gimme a break by Anonymous Coward · · Score: 0

    mod parent down!
    anyone at all familiar w/ c programming knows he is speaking gibberish .....foolish mods!

  18. Re:VB.Net is NOT VB 7 by twoflower · · Score: 2, Informative
    It's kind of like an san script to english translator.
    Never heard of "san script". "Bash script", maybe. You probably meant "sanskrit". HTH, HAND.
    --


    --
    Twoflower
  19. Whoops by RingDev · · Score: 1

    Just saw you said VC, not VB. Not quite as bad in the conversion that way as you should already be using OO design. -Rick

    --
    "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  20. VC++ 2005 issues for embedded developers by demigod2k · · Score: 3, Informative

    I would love to use VS2005 as an IDE for embedded development. Unfortunately, certain things are easy with VC6 and nmake, but awkward or impossible with VS2005 and VCBuild.

    I was unable to setup my cross-compiler. With VS2005 it's possible to override the rule for *.c files and specify an alternate compiler, but there is no way (in beta2) to replace the built-in rule for *.o files and use an alternate linker. VC++ "custom build rules" are insufficient because they only act upon files that appear in the project, not files that are generated as output from a previous build stage. There are some half-baked workarounds like adding "dummy" *.o files to the project, but nothing I've found reasonable.

    The MSBuild system looks awesome, but VC++ 2005 only has support for the VCBuild subset. It's a lot more limiting, and something to keep in mind.

  21. Re:VB.Net is NOT VB 7 by Anonymous Coward · · Score: 0

    VB.NET isn't VB7? Whew! It's a good thing they're using C++, then, isn't it?

  22. If it ain't broke... by N7DR · · Score: 3, Insightful

    I have a project that's about 1/3 the size of yours, with VC++ 6.0 as the development environment.

    Out of interest I purchased VC++.NET 2003 a while ago.

    Once I fired it up and tinkered a bit with the IDE, all thought of porting the project went away. Things look quite different (and, at least in my case, the help that came in the package was a big fat zero). I eventually worked out how to build a small test project and have it run. But to take a complex pre-existing project looked like a job that one would take on only if one absolutely needed something that was only available in 2003 .NET. (In fact, my first reaction on seeing the IDE was: Good Grief! Why does everything nowadays have to be so complicated? I had hoped for a reaction along the lines of: Oh good! This looks like something I'm used to. But it was Not To Be.)

    Now, rumour has it that the 2005 .NET compiler is going to have lots of support for fancy stuff like template metaprogramming. So I can see using it for new projects if the new stuff is going to be useful in those projects. But as for porting an old project, I have to assume that 2005 is going to be at least as far removed from 6.0 as 2003 .NET was. And since you already have the project building and working under 6.0, I would not recommend the switch.

    Maybe if you have the capability and version control resources to keep using 6.0 as your mainline code while you tinker to get 2005 .NET working, then that might be reasonable. But unless you have spare people/time, I honestly don't think it would be wise to try to make the switch

    1. Re:If it ain't broke... by Anonymous Coward · · Score: 0

      Now, rumour has it that the 2005 .NET compiler is going to have lots of support for fancy stuff like template metaprogramming.

      This stuff already works with the 2003 compiler.

      But as for porting an old project, I have to assume that 2005 is going to be at least as far removed from 6.0 as 2003 .NET was.

      At least as far as the compiler is concerned, that's impossible. 6.0 was about <pulling_numbers_out_of_ass>63% compliant with the standard, whereas 2003 was about 96%.</pulling_numbers_out_of_ass> There just isn't that much room for improvement.

      And in practice the difference isn't that much either. (I use 2005 every day.) It's different, sure, but the jump from 6.0 to 2003 was just huge.

      My advice would be to use the 2005 compiler, but stick with the 6.0 IDE. You don't really gain much from converting the build system (although the IDE is neat), but the code will see benefits. Once you've done that, THEN think about changing IDEs. At the very least, fire up the new compiler and see what errors you get. If it's good code there shouldn't be much patching to do.

  23. Why bother? by DavidYaw · · Score: 3, Insightful

    The question to ask is, why upgrade at all? Is there something wrong with MSVC 6? Does it all of the sudden not work?

    If the only reason to upgrade is because some not-too-informed person (be it PHB or novice programmer) wants to be running the latest-and-greatest, then don't.

    1. Re:Why bother? by frank2 · · Score: 2, Informative

      Because VC6 generates poor code for today's CPU's. Numerous issues which are generally only known to assembly language geeks or compiler writers cause the code to not work as efficiently as possible. Our rendering code under VC2005 executes on average in about 2/3 the time that it does under VC6. How much is a CPU/system upgrade going to cost you to get that kind of performance gain??? ;)

    2. Re:Why bother? by slcdb · · Score: 4, Interesting
      Is there something wrong with MSVC 6?
      Yes. Well, it's not actually anything intrinsically wrong with VC6, but Microsoft has managed to cripple it. All new Platform SDKs are now using a library format that is incompatible with VC6's linker.

      So now if an application wants to take advantage of some of the newest Platform SDK functionality (e.g. stuff that's new in Vista), VC6 will likely not be able to link with the required libraries.

      I doubt that there was anything that absolutely needed to be changed with regard to the library format. I'm of the opinion that this was a carefully crafted Microsoft strategy to force developers to stop using VC6 (which is the oldest Visual Studio release that still has a large number of active users).
      --
      Despite what EULAs say, most software is sold, not licensed.
    3. Re:Why bother? by PseudoQuant · · Score: 1

      Also, VC6 is not very good with C++ standard compliance. Moving forward should let you have a lot more flexibility with third party library availability.

    4. Re:Why bother? by vcv · · Score: 1

      Better Performance. Better productivity in the IDE.

    5. Re:Why bother? by agm · · Score: 1

      I bought "Visual Studio.net C++ 2003" because I needed to buy a copy for a financially quite rewarding contract. I avoid MS solutions as much as I can (and run Gentoo everywhere) but with the $$ on offer I had little issue with paying for a copy of XP and "VS.net C++ 2003" (all running under VMWare on Gentoo of course). The problem was I could not purchase Visual Studio 6 (which I am familiar with). No one would sell one, so I had no choice but to buy the latest version (or break the law, which I won't do with software).

    6. Re:Why bother? by cookd · · Score: 2, Insightful

      VC 6 was released in 98. Do you develop apps for the latest version of Linux with GCC 2.8 (VC 6's contemporary) and GLibC 2.0.7? If you're targeting older platforms (Windows 98), I could see why you might want to stick with VC 6. But otherwise, use the best tool for the job.

      Since VC was released, there have been 7 years of bug fixes and improvements to the compiler. Lots of new optimizations, warnings, and security features. Not all of them are trivial. And the runtime has had a lot of work -- much closer to the C++ spec.

      Finally, VC 6.0 is no longer supported by Microsoft. No bug fixes, patches, security checks, etc. The 6.0 CRT might still get updated, but the compiler won't.

      The longer you wait before upgrading, the harder it is to upgrade. It may actually take less time total to do it less often, but the process is much smoother and causes fewer problems if you keep up to date.

      --
      Time flies like an arrow. Fruit flies like a banana.
    7. Re:Why bother? by jerdenn · · Score: 1

      Visual Studio 6.0 comes with an MSDN subscription, so yes, you could have purchased this software. However, it would have cost quite a bit more than VS.NET C++ Standard Edition (2003).

    8. Re:Why bother? by Anonymous Coward · · Score: 0

      eBay is loaded with copies of VS 6.

    9. Re:Why bother? by EvlG · · Score: 2, Interesting

      Visual Studio 2005 also includes a new feature called Profile Guided Optimization.

      This feature allows you to make a special build of your program which instruments your code with performance metrics gathering code. You run your program and it automatically gathers a bunch of data. Then you rebuild the program and the compiler looks at the performance metrics and can make special optimizations targeted at your application.

      I spoke with the developers about this feature and they quoted a 20-30% speedup in Yukon (the next version MS SQL Server) - for free, just by having a better compiler.

    10. Re:Why bother? by Anonymous Coward · · Score: 0

      You're right, the library format didn't change. The code did.

  24. Re:VB.Net is NOT VB 7 by RingDev · · Score: 1

    LOL, good catch. I'm going to go replace myself with a small shell script.

    -Rick

    --
    "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  25. Third Way by mkcmkc · · Score: 1
    The market for programmers seems to be warming up a little. Rather than try to decide between two losing alternatives, maybe it'd be better to just work on your resume...

    Mike

    --
    "Not an actor, but he plays one on TV."
  26. What is the "proper" scope? by Anonymous Coward · · Score: 0

    As a n00b, I'll bite... what is the proper scope for the index of a for loop? That is, what *should* the code look like?

    1. Re:What is the "proper" scope? by boneshintai · · Score: 1
      for (int i = 0; i < foo; ++i) {
      ...
      }

      // note re-declaration
      for (int i = 0; i < bar; ++i) {
      ...
      }

      In C++, at least, the scope of entities declared in the for loop is limited to the loop body. Of course, you should avoid using the same loop index twice anyways, in favour of using a more meaningful identifier.

    2. Re:What is the "proper" scope? by Anonymous Coward · · Score: 0

      I've run into compilers (on SGI maybe?) that will still issue an error with your posted code. The compiler thinks you're trying to re-define "i". The only good way to get around it is to use different variables as you suggested or declare "i" before the first loop.

    3. Re:What is the "proper" scope? by turator · · Score: 1

      A couple of points here:

      Firstly, the scoping rules were actually changed with the 1997 C++ standard, so the older compilers are simply following the old rules. They are not vendor specific extensions.

      Secondly, some people would say that in good OO code, methods are small and focused. In that case a single method rarely needs to contain more that one for loop, so the scoping rules are not an issue.

  27. Linux is not a compiler. by Anonymous Coward · · Score: 0

    While the preferred method would be simply use Linux, unfortunately my company is using Microsoft Visual Studio 6.0 with C++

    Quit with the "Linux solves everything" cluelessness - Linux is not a C++ compiler. You mean to say that you think you'd rather develop under Linux than Windows. Okay, but then you have to decide what compiler (probably GCC) build system (Make, Scons?), version control (Subversion, CVS?) and what IDE or text editor to use (Eclipse, vi, Emacs?). If you're working in a team, it's going to be essential to at least standardise compiler and build system.

    One thing you may be overlooking is that it's easy to duplicate what you refer to as the "Linux" toolchain experience on Windows - proving that there's nothing exclusively "Linux" about them. Thank GNU and the open source movement, not necessarily some guy from Finland:

    * MingW32 is an excellent port of GCC to Windows. It probably has some difficulty compiling MSVC-specific code (I doubt MFC and .NET classes work), but you should ideally be using a cross-platform framework like wxWidgets instead anyway.

    * Scons is a great Python based build scripting system. It leaves Makefiles in the dust as it allows you to use Python logic in the make process. I've personally run it on four different platforms (Windows, Linux, FreeBSD and Mac) and would never go back to Make. Although it helps, but is not necessary to be a Python fanatic (and if you don't know Python, take 20 minutes to follow the "Instant Python" tutorial linked on their site - it's possible you will fall in love with the language instantly).

    * Eclipse is a nice cross-platform IDE that works well on Windows (and Linux, FreeBSD and the Mac). When used with the C++ extensions you get full syntax highlighting, project browsing and integrated debugging. Via custom project settings, it can be easily told how to build Scons projects instead of Makefile ones. (The only problem I've ever had working with Scons is requiring different settings to build Debug and Release builds, but I just set the IDE up to do Debug [work with that most of the time], then compiling and running Release from the command line).

    And all of the above can be made to work nicely on Windows and Linux. If you switch to using those cross-platform tools on Windows, at some point your choice of platform becomes irrelevent and transitioning to Linux becomes extremely easy.

  28. Changing compilers is always fun . . . by ChefAndCoder · · Score: 2, Interesting
    Interface wise, I think the Microsoft dev products are pretty good and I felt they tended to improve with each version. Guessing based on my transition from VC6 to 2003, you shouldn't have too many problems with the new look and feel.

    Now, I'm assuming that you're also planning to change the compiler you use in VC6 to whatever they've got for 2005. And this is where things get fun.

    At my last job, we switched compilers on two occassions. The first time was a disaster, and our QA team was flooded with defect reports - see, as we did this shortly before a major release and learned a painful lesson.

    Recently, we migrated from VC6 to the VC7 compiler. We continued to compile both versions for almost a year before we finally committed to the new compiler. I think the newer compilers are better for error detection in the compilation phase, but you will have to carefully watch out for subtle bugs that don't appear simply because of how the compiler used to behave.

    A couple of years ago, there was a great article in Dr. Dobbs about using multiple compilers from different vendors as a great way to help catch errors in your code as well as use safer programming practices. Our migration pain highlighted just how much this one practice could have spared us in the long run.

  29. What benefits are there, by BlindRobin · · Score: 1

    ...and what things do we lose?
    why your eternal souls of course



    ...uhh but then you've already done that... damn!

  30. Headers, STL, linkage by aminorex · · Score: 1

    These were the biggest areas of pain for me: Header file dependency changes, STL namespace issues, and linking model.

    The only benefit I found was smaller object code size. Oh, and debugging is somewhat improved. If you were going full-on .NET the benefits would be substantial, of course.

    --
    -I like my women like I like my tea: green-
  31. STL by Anonymous Coward · · Score: 0

    Yes. Yes there is. It doesn't fully support the STL unless you use a 3rd party lib like STLPort. VC7 fixes this in addition to being faster and having a nicer gui.

  32. Why are you upgrading? by Geoffreyerffoeg · · Score: 3, Insightful

    What benefits are there, and what things do we lose? What problems will occur?"

    If you're looking mainly at upgrading the compiler, you can download the command-line compilers for free and you can see if it compiles well or not, or if language features you wanted to use are there. These are both the .NET compilers (CSC, VBC, etc.) and the regular compilers (CL, etc.). CL compiles both normal C++ (I've used it on the same code I gave to g++) and Managed (Embraces and) Extensions for C++.

    Otherwise you're looking at upgrading the IDE, which is motivated by how much your programmers like or dislike the 6.0 IDE. And if you buy 2005, you're probably going to be upgrading both, so you need to make sure that both will work better (or one better, one as well) as those in 6.0.

    1. Re:Why are you upgrading? by arkanes · · Score: 1
      It's nominally possible to use the toolkit as a drop in replacement for the C++ 6.0 tools, while still using the VC 6 IDE, but you'll lose debugging because VC 6 can't read the debugging info the 2003/7 compiler generates.

      VC 2005 is all around superior to VC 6 in pretty much every way and there's not really any good reason not to switch other than inertia. You get a better compiler, a better IDE, better standards compliance, etc.

  33. Why is strlen "unsafe"? by mangu · · Score: 1

    I can see why a function like strcpy, which writes to memory, is unsafe, because it can keep writing forever if there is no terminating zero in the source string. But strlen is unsafe? Why? At most it will consume CPU when counting an unterminated string. It's implemented somehow like this: for (n = 0; *str; n++) str++; If the string is unterminated, eventually this function will segfault, but I cannot see any bigger harm done.

    1. Re:Why is strlen "unsafe"? by cookd · · Score: 3, Interesting

      Three issues:

      1. Resources. It might slow down the system while scanning for the nul.
      2. SegFault is still not a good idea.
      3. Most important: The result from strlen gets used elsewhere. If the string is unterminated, you've just put a large random number into your code. Somebody else might assume that the result from strlen is a reasonable size (10-20 bytes), when it really is more like 10k, and you weren't prepared for a 10k string.

      --
      Time flies like an arrow. Fruit flies like a banana.
    2. Re:Why is strlen "unsafe"? by Anonymous+Brave+Guy · · Score: 1

      There's an easy workaround. What you do is this:

      size_t length_bound = strlen(my_string);<br>
      size_t length = strlen_s(my_string, length_bound);

      This handy snippet adapts readily to strings of any size, while still reporting the length of your string accurately using the safe

      strlen_s
      function.

      HTH. HAND. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  34. Try Visual C++ Toolkit 2003 by bunratty · · Score: 1, Informative

    To get a rough idea of how bad it will be, download MS Visual C++ Toolkit 2003 (available for free) and recompile your code. From my limited experience with porting Visual C++ 6.0 code to Visual C++ 2003, look for lots of compiler errors. Those may be good to fix, though, since the C++ compiler seems to more closely follow the standards, and you'll be forced to make your code more standards compliant and probably more portable, too.

    --
    What a fool believes, he sees, no wise man has the power to reason away.
    1. Re:Try Visual C++ Toolkit 2003 by RupW · · Score: 1

      Anyone can get hold of an 'express' edition of the whole IDE for free - there's no reason to judge it on the 2003 compiler.

      And if they're a serious Windows dev shop they'll probably have an MSDN subscription and already have access to the new version anyway.

  35. Re:.Net 2 by Surye · · Score: 2, Informative

    You can, you have to set a compiler flag for old syntax and 1.1

  36. Been there, done that, no t-shirt. by cookd · · Score: 5, Informative

    I work at MS, and we generally stay on top with compilers. In fact, our new security policies require all shipping code to be compiled with the 7.1 compilers, and pretty soon all code will be required to use 8.0.

    I'm the one who upgraded our 2-million line product from 6.0 to 7.1 and from 7.1 to 8.0. In the process, we had about 20,000 compile errors or warnings to fix. I think I was able to fix about 5,000 per week. It was a lot of work, but we actually found bugs and issues in the code. It was certainly worth the effort. Note that we don't actually use the VS IDE to build -- we use the compiler directly from the command line with makefiles.

    In general, I would update to the new compiler and turn off all of the new warnings and errors until I got everything building. Then I would re-enable all of the new warnings and work on fixing them. Use the /Zc:forscope- and /Zc:wchar_t- flags at first. One thing to be aware of is that some "errors" are actually warnings that are turned up to "error" status (see the /we flag). These can be changed with the /w flag or with a #pragma warning.

    Advantages to the new compiler:

    * Better C++ Standards compliance.
    * Much better code generation (your program runs faster).
    * Many fixed "Internal Compiler Error" issues.
    * A few fixed code generation (invalid optimization) issues.
    * Many new warnings about things that deserve them.
    * Much better debug information.
    * Much better handling of templates.

    Disadvantages to the new compiler:

    * Somewhat slower compile time in some cases.
    * Larger PDB (debug symbol) files.

    Advantages to new C library:

    * Much better C++ compliance.
    * Many bugs fixed.
    * Better performance.
    * Many security fixes.

    Disadvantages to new C library:

    * Cannot expect runtime to be present on the user's system. (msvcrt.dll and mfc42.dll are already installed on most computers, but msvcr71.dll and mfc71.dll are not).
    * Some porting incompatibilities.

    Advantages to the new Visual Studio IDE:

    * Better Intellisense.
    * Support for excellent code coverage, profiling, unit test, and static analysis tools.
    * Better debugging.
    * Supported (VS 6.0 is 7 years old now -- all support for it is over).

    Disadvantages to the new IDE:

    * Uses more memory and system resources.
    * Beta version has several performance issues. The final version should fix them (cross fingers).

    General issues:

    * You'll need to recreate your project (*.dsp) and workspace (*.dsw) files.
    * Some porting will be required for MFC and ATL apps.
    * You may hit one or two CRT changes.
    * You may have several thousand warnings or errors. Nearly all of these can be eliminated via compiler flags or #pragmas, but you should really fix them if possible.
    * Some CRT functions have been deprecated. You can add a #define to ignore this, but if you care about buffer overflows in your code, you should really take a look at using the "safe" versions.

    --
    Time flies like an arrow. Fruit flies like a banana.
    1. Re:Been there, done that, no t-shirt. by NullProg · · Score: 1

      * You may hit one or two CRT changes.
      Please explain the CRT changes or point me to an article on MSDN.

      * Some CRT functions have been deprecated. You can add a #define to ignore this, but if you care about buffer overflows in your code, you should really take a look at using the "safe" versions.

      Our software is O/S and CPU agnostic. It runs under Unix and Windows and all the primary logic routines are written in C/C++. Are you saying that Microsoft broke the standard C libary? Why not just patch the msvcrt.dll to perform bounds checking in the libarary call and generate a SEH frame? Wouldn't that be easier than depreciating the C runtime? And yes we care about buffer overflows which is why we have audited our own software and addressed the security concerns.

      Just curious,
      Enjoy.

      --
      It's just the normal noises in here.
    2. Re:Been there, done that, no t-shirt. by RupW · · Score: 1
      Are you saying that Microsoft broke the standard C libary?

      No, they're trying to convince you to use safer versions of the functions with extra parameters. You get a warning
      This function or variable may be unsafe. Consider using strnset_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.


      They've proposed all the new *_s versions to the C standards committee, I think - they're trying to improve things rather than lock everyone in. In general the functions just add an extra parameter so you could always #define the *_s versions to call the originals discarding the extra param.
    3. Re:Been there, done that, no t-shirt. by cookd · · Score: 1

      Breaking Changes in the Standard C++ Library Since Visual C++ 6.0
      If you are upgrading a program that uses Standard C++ Library code that compiled in Visual C++ 6.0, you should be aware of the following issues:

      • reverse_iterator Changes
      • Some Iterators Are No Longer the Same as Pointers
      • MIN/MAX #define Change

      Nothing got "broken". But if you were abusing the CRT, you might now have to pay the price. As far as the deprecated functions -- if you #include certain headers (generally, if you directly or indirectly #include "strsafe.h"), you'll find that some APIs will cause compiler warnings or errors. Things like strcat and strcpy, which take no buffer lengths, are quite dangerous. Yes, the programmer can verify things before calling them, but if you screw up once, you have a problem. The replacements all require the buffer length to be specified.

      --
      Time flies like an arrow. Fruit flies like a banana.
    4. Re:Been there, done that, no t-shirt. by NullProg · · Score: 1

      Thanks for the link. You still didn't answer my other question though....

      Why not just patch the msvcrt.dll to perform bounds checking in the libarary call and generate a SEH frame? Wouldn't that be easier than depreciating the C runtime?

      Would that not be easier? When thinking about this issue this afternoon, I had another thought. If 90 percent of the Windows vunerablities are using Outlook/Win32/IE/ActiveX/ and open port exploits, why is Microsoft blaming these on the CRT? My code/open ports are safe. Isn't this a problem with your code?

      Thank You again for the response. I'm not trying to start a fight. I'm just a long time in the 'trenches' developer attempting to write/maintain good cross-platform code. If I still had to write OS/2 code I'd be bitching at IBM about now.

      Enjoy,

      --
      It's just the normal noises in here.
    5. Re:Been there, done that, no t-shirt. by cookd · · Score: 1

      Not sure how you would do that in a way that stops buffer overflows. What would you expect to have happen with strcat? How can strcpy detect a buffer overflow? It might detect a really wild buffer overflow that wanders into read-only or unmapped address space, in which case you get an Access Violation (SegFault). In that case, all it could safely do is abort the program -- and that's what happens today. The dangerous buffer overflows are the ones that only overflow by a few hundred bytes. No Access Violation, since the memory is still valid. Without additional information, there is nothing msvcrt can do to detect that there was a problem.

      I suppose it could check the address range of every parameter that got passed into it, and if it is about to write over the current function's stack frame it would abort, but what if you actually wanted to overwrite your stack frame? Anything they do would be breaking the C specifications.

      The "Safe" versions are mostly versions that have an additional parameter with the buffer size. There are a very few versions with the same parameters but slightly different behavior in the edge cases, but mostly it is just the version you are familiar with plus an extra "max buffer size" parameter.

      --
      Time flies like an arrow. Fruit flies like a banana.
    6. Re:Been there, done that, no t-shirt. by Anonymous Coward · · Score: 0

      Had M$ finally innovated parallel builds within IDE? The CLI tools are so ugly on windows, that availability of make is of little help for me.

  37. Do it! by mario+contestabile · · Score: 1

    If only for the better debugger...vc6 is what, 10 years old? I went (on a large scale app) from vc6->vc7.1 for our production code. You'll certainly have more work going from vc6 to vc8 directly. But the project file extensions changed, so its easy to use both your compilers side-by-side. Areas of pita were templates and for() loops and ATL generated unregistering code

    --
    http://superconfigure-supergroove.appspot.com/
  38. OT, but you might know... by bmac · · Score: 2, Interesting

    I've been trying to build a c++ app w/ the original VS Studio .NET, and I'd really like to not link to the standard C libs at all (like libc.lib). I'd really like to just link to the main three: kernel32.lib, user32.lib and gdi32.lib. I've tried /NODEFAULTLIB but that leaves me hanging with a handful of unresolved linker refs to what appears to be auto-generated fct calls (like _RTC_CheckEsp and ___CxxFrameHandler).

    Do you know if I can do a clean link to just the "main 3"?

    I would really appreciate the help.

    Peace & Blessings,
    bmac

    1. Re:OT, but you might know... by cookd · · Score: 3, Informative

      Yes, you can. You just have to disable the compiler features that correspond to the function calls you don't want.

      _RTC_CheckEsp comes from the /GZ or /RTCs compiler switches. Turn off the "Runtime Checks" options.

      ___CxxFrameHandler comes from /GX or /EH??. Turn off the "Exception Handling" options.

      With more recent versions, you might see something about "security_cookie". For that, turn off the buffer overflow detection (/GS).

      Good luck!

      --
      Time flies like an arrow. Fruit flies like a banana.
    2. Re:OT, but you might know... by cookd · · Score: 1

      Another thing to keep in mind that when you do this, your program's "Entry Point" is NOT "int main(char**, int)" or "int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)". The raw entry point is simply "int MyEntryPoint()" with NO parameters (name doesn't matter since you just pass the name of the entry point to the linker). You can call it main or WinMain, and you can specify whatever parameters you want, but the parameters won't be initialized.

      Normally, the CRT provides the raw entry point, initializes itself (initializes all globals). It calls kernel32.dll to get the command line, parses it, and calls either WinMain() or main() depending on various factors. So if you want the command line, you'll have to get it via GetCommandLine() and parse it yourself.

      The nice thing is that by doing all of this, you can actually write a useful C++ program that is only 1024 bytes. (It is probably possible to get a Win32 program into 512 bytes, but I don't think it is possible with the C++ compiler and linker -- you'd have to hex-edit the binary by hand.)

      --
      Time flies like an arrow. Fruit flies like a banana.
    3. Re:OT, but you might know... by bmac · · Score: 1

      Thank you *so* much. Now, all I have to do is code my versions of strlen, memset and all. I really appreciate you replying to my OT post, because google wasn't able to help me on this one.

      Peace & Blessings,
      bmac

    4. Re:OT, but you might know... by cookd · · Score: 1

      You might be able to avoid even that. Try adding /Oi to the command line.

      --
      Time flies like an arrow. Fruit flies like a banana.
  39. Re:.Net 2 by Fr05t · · Score: 1

    I'll have to check it out again then. At the time there were only crazy half baked hacks people had put together. If MS has given it better support I may switch over since I found it to be a pretty good improvement over VS2003.

    Thanks for the info.

  40. Re:.Net 2 by BigJimSlade · · Score: 1

    It would be a non-issue. If he's moving from VS 6.0, he isn't using .NET at all.

  41. Took a while for small project... by Anonymous Coward · · Score: 0

    A small VC6 project (about 20,000 lines) to VC .NET 2003 took a few days to convert mostly because of changing compliance to standards between the 2 versions. Other than that only a few problems. But it still took a while, and because it was such a large change (almost every file in the project was changed) there was tons of time consumed in end to end testing (not counting the time used rewriting the now non-compiling code).

  42. Re:VB.Net is NOT VB 7 by Kosgrove · · Score: 1

    You are completely offtopic (as am I in responding), but you're also incorrect. VB.NET (.NET framework 1.x) is VB7, just as .NET Framework 2.x is VB8. It's even referred to that way in MSDN white papers. However, you are correct in your observations about MSFT breaking backwards compatibility in VB.NET and the crappyness of the converter. While the version is labelled 7, it might as well be a whole new language.

  43. Re:VB.Net is NOT VB 7 by RingDev · · Score: 1

    Agreed on the off topic, but as long as we are discussion...

    VB.Net is not the next version of VB. Just like C# is not the next version of C++. All .Net languages (C#, J#, VB.Net, ASP.Net, etc) are CLI based. When I compile my application in VB6, it creates a COM based Win 32 compatible, x86 native assembly. When I compile my app in VB.Net, C#, or any other .Net language, it gets compiles to CLI. The CLI assembly is then distributed. When a user runs it, the local Framework compiles the CLI into what ever native type is needed.

    The converter is great. it works exactly how a converter should. The problem though is that VB.Net requires a completely different design theory. Imagine a 'converter' that changes a bicycle (VB 6) into a Car (VB.Net). The converter can identify the bicycle's frame, wheels, steering controls, and brakes and match them up loosely with the car's components. But a bike only has 2 wheels, a car has 4. The car now has an engine, but the bike doesn't, so it can't be converted. And so on.

    As for the labeling. Yeah for some reason there are obscure references to VB7, which drives me nuts. But all of the presented version identifiers refer to it as VB.Net (2k2, 2k3, and 2k5)

    -Rick

    --
    "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  44. VC6 doesn't work with the new "secure" libs by I'm+Don+Giovanni · · Score: 1
    "I doubt that there was anything that absolutely needed to be changed with regard to the library format. I'm of the opinion that this was a carefully crafted Microsoft strategy to force developers to stop using VC6 (which is the oldest Visual Studio release that still has a large number of active users)."

    Um, no.
    http://blogs.msdn.com/loripe/archive/2005/05/02/41 4100.aspx

    The real technical reason [that the PSDK no longer supports VC6] is because the later compilers and library add enhanced security. The libraries are compiled with /GS. This was not previously supported (not in VC6) but is part of our security initiatives and drive to eliminate buffer overruns. The two articles below describe the new functionality in detail. VC6 is not as secure and does not have these enhancements. XP SP2 itself was compiled with the switch which is why we see the issue start in XP SP2. Windows Server 2003 SP 1 is even more strict in it's adherence. The compilers included in the SP1 PSDK and most of the libraries comply as well and simply won't work with VC 6.
    --
    -- "I never gave these stories much credence." - HAL 9000
    1. Re:VC6 doesn't work with the new "secure" libs by slcdb · · Score: 2, Interesting

      I find your sig particularly ironic. You'd be right if you believe this line they are feeding people who ask about the incompatibility. But if you scrutinize their answer a little, you'll find that something is fishy about it. I for one, give Microsoft's story little credence :)

      The /GS option basically causes the compiler to insert extra code into each compiled function. But that extra code does not need to cause a change to the library format. All it does is add additional instructions and data in the object file. You could actually write your own code that does exactly the same thing, without using the /GS compiler switch. The compiler switch makes it lot easier, because otherwise you'd have to add this code to every function you write.

      But it should not change anything from the linker's perspective. It should be able to link an object file regardless of whether this extra code is present or not (and libraries are just collections of object files). From the linker's perspective, it shouldn't matter whether this extra code is generated by /GS or was written by hand by the programmer.

      Sure, Microsoft may have chosen to implement the /GS switch in a way that's not backward-compatible -- but they didn't need to and if they really did care about VC6 users, they would have opted to use a backward-compatible approach.

      Want proof that this can be done in a backward-compatible way? Read about StackGuard a patch created circa 1998 that brings this exact same functionality to GCC. It is available in some hardened versions of GCC. Another similar GCC patch, ProPolice is also in other hardened versions of GCC (that used by OpenBSD and Hardened Gentoo Linux, for example). Eventually, one of them will be chosen to be included as a standard feature of GCC. Both generate "protected" code that is compatible with unprotected libraries compiled with other compilers.

      --
      Despite what EULAs say, most software is sold, not licensed.
  45. You're a madman, and I admire it! by tjstork · · Score: 1

    There were significant changes in how ATL and MFC were used in VC 2002, so, you are going to have touch a fairly big portion of your code. I've found that for 64 bit targets, Visual Studio 2005 is not at all ready for prime time.

    --
    This is my sig.
  46. So, when will there be a native 64 bit IDE? by tjstork · · Score: 1

    It's kinda hard to trust a tool for 64 bit development when it itself is not 64 bit.

    --
    This is my sig.
    1. Re:So, when will there be a native 64 bit IDE? by cookd · · Score: 1

      All you have to trust are the compilers. The rest is mostly irrelevant. And since the 32-bit version runs just fine on a 64-bit AMD64 chip, what is the value of porting it? I'd personally rather have more work done on ironing out issues on the 32-bit version than on working on making a 64-bit version work.

      Everything takes time. Adding 64-bit versions means cutting other work. It just isn't worth it at this point.

      For programs where the 64-bit version has extra capabilities (speed, scalability) that the 32-bit version doesn't, the port to 32-bit native makes sense. Otherwise, why does it matter?

      --
      Time flies like an arrow. Fruit flies like a banana.
  47. My experience from 6 to .NET by ProZachar · · Score: 1

    It's not quite what you're looking for, but here goes:

    We use 6 at my work. I have .NET at home. One day I brought a copy of the project home and tried to build it. Errors and warnings abound. I gave up. Of course, my coworkers learned C++ "on the fly" in 1999 with this project and it shows. So if you wrote "good" code and you're not trying to do things you shouldn't be doing, like

    enum EnumeratedType {Alpha, Bravo, Charlie, Delta};
    CString Text;
    EnumeratedType ET = Alpha;
    Text = ET; //expecting the text "Alpha" to be in Text

    then you should be OK.
    (go ahead and laugh, that's in the code MANY times)
    (By the way, these are the same people that think SQL databases are for "bad programmers who can't roll their own")

  48. Re:VC++ 2005 issues for embedded developers by Anonymous+Brave+Guy · · Score: 1

    Are you sure VC++ 2005 doesn't support nmake and CLI tools? Our group has been using makefile builds in every VC++ version for years, some of our colleagues have been working with the 2005 beta for a while now, and no-one's mentioned any fundamental changes...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.