Migrating from MSVC 6.0 to Studio 2005? 130
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?"
what? concerns about MS compatibility? (Score:4, 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.)
real life experience? (Score:2, Funny)
Nope, only work related experience.
Sorry I couldn't help.
.Net 2 (Score:3, Informative)
Several months ago the beta wasn't able to compile
Re:.Net 2 (Score:3, Informative)
Re:.Net 2 (Score:2)
Thanks for the info.
Re:.Net 2 (Score:2)
Comments are for wimps. (Score:2, Funny)
grep -v -e "^\/\/" oldfoo.c > newfoo.c
Very poor (Score:5, Informative)
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.
Re:Very poor (Score:3, Insightful)
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.
Re:Very poor (Score:5, Informative)
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.
Re:Very poor (Score:3, Informative)
"say goodbye":
http://msdn.microsoft.com/library/default.asp?url=
more info on strsafe.h (included in the VC.NET 2003 SDKs and up):
http://msdn.microsoft.com/library/default.asp?url=
Why is strlen "unsafe"? (Score:2)
Re:Why is strlen "unsafe"? (Score:3, Interesting)
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.
Re:Why is strlen "unsafe"? (Score:2)
There's an easy workaround. What you do is this:
This handy snippet adapts readily to strings of any size, while still reporting the length of your string accurately using the safe
function.HTH. HAND. :-)
Re:Very poor (Score:3, Informative)
Re:Very poor (Score:2)
Thanks for correcting me, though - one day I'll finally get it right.
Re:Very poor (Score:1)
Re:Very poor (Score:2)
Re:Very poor (Score:2, Informative)
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.
Re:Very poor (Score:2, Interesting)
Re:Very poor (Score:1)
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
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
Re:Very poor (Score:1)
Re:Very poor (Score:1)
Re:Very poor (Score:2)
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.
Re:Very poor (Score:2)
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?
Should you upgrade? (Score:1)
Painful (Score:2, Informative)
Re:Painful (Score:2)
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.
Re:Painful (Score:2)
Work smarter, not harder.
i.e. There are utils/macros to do that, specfically, you'll want to check out...
1. Project Converter [codeproject.com]
2.
--
If the Bible is infallible, which version would that be?
One Tip... (Score:5, Funny)
Experience with .NET (Score:4, Informative)
Re:Experience with .NET (Score:1)
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 [gamesfromwithin.com]
Re:Experience with .NET (Score:1)
Remove the
Some unfixed bugs still ... (Score:5, Funny)
Re:Some unfixed bugs still ... (Score:2)
You should be fine.. (Score:4, Informative)
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.
Re:You should be fine.. (Score:1)
Sloppy Programming will cause issues (Score:3, Informative)
so things like this (which you shouldnt be doing anyway): 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
Re:Sloppy Programming will cause issues (Score:1)
Re:Sloppy Programming will cause issues (Score:1)
MVSC++ 6.0 let most of it slide, bit us hard when we took it to 2003
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 w
Re:Sloppy Programming will cause issues (Score:2)
You mean, other than using a variable outside its scope?
Re:Sloppy Programming will cause issues (Score:3, Interesting)
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, b
Re:Sloppy Programming will cause issues (Score:3, Insightful)
Re:Sloppy Programming will cause issues (Score:2)
Duh.
Re:Sloppy Programming will cause issues (Score:3, Insightful)
No problem, right? But say a year later, you come along and find that you need to modify your code to something like this:
Re:Sloppy Programming will cause issues (Score:1)
Re:Sloppy Programming will cause issues (Score:2)
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.
Re:Sloppy Programming will cause issues (Score:2)
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+
Re:Sloppy Programming will cause issues (Score:1)
Re:Sloppy Programming will cause issues (Score:1)
void myfunc()
{
{
for (int i = 0; i < 10; i++)
{
}
}
{
for (int i = 0; i < 10; i++)
{
}
Re:Sloppy Programming will cause issues (Score:2)
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 c
Re:Sloppy Programming will cause issues (Score:2)
This is a documented Microsoft syntax extension. You can disable it with
Re:Sloppy Programming will cause issues (Score:2)
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.
Re:What is the "proper" scope? (Score:2)
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.
Migration Problems (Score:3, Insightful)
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).
Go for it (Score:5, Informative)
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$.
VC++ 2005 issues for embedded developers (Score:3, Informative)
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.
Re:VC++ 2005 issues for embedded developers (Score:2)
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 it ain't broke... (Score:3, Insightful)
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
Now, rumour has it that the 2005
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
Why bother? (Score:4, Insightful)
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.
Re:Why bother? (Score:2, Informative)
Re:Why bother? (Score:1)
Re:Why bother? (Score:5, Interesting)
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).
Re:VC6 doesn't work with the new "secure" libs (Score:3, Interesting)
The
Re:Why bother? (Score:1)
Re:Why bother? (Score:2)
Re:Why bother? (Score:1)
Re:Why bother? (Score:2, Insightful)
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 cl
Re:Why bother? (Score:3, Interesting)
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 Yuko
Third Way (Score:2)
Mike
Changing compilers is always fun . . . (Score:2, Interesting)
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 defe
What benefits are there, (Score:1)
why your eternal souls of course
Headers, STL, linkage (Score:2)
The only benefit I found was smaller object code size. Oh, and debugging is somewhat improved. If you were going full-on
Why are you upgrading? (Score:4, Insightful)
If you're looking mainly at upgrading the compiler, you can download the command-line compilers for free [microsoft.com] and you can see if it compiles well or not, or if language features you wanted to use are there. These are both the
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.
Re:Why are you upgrading? (Score:2)
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.
Try Visual C++ Toolkit 2003 (Score:2, Informative)
Re:Try Visual C++ Toolkit 2003 (Score:2)
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.
Been there, done that, no t-shirt. (Score:5, Informative)
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
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.
OT, but you might know... (Score:3, Interesting)
Do you know if I can do a clean link to just the "main 3"?
I would really appreciate the hel
Re:OT, but you might know... (Score:3, Informative)
_RTC_CheckEsp comes from the
___CxxFrameHandler comes from
With more recent versions, you might see something about "security_cookie". For that, turn off the buffer overflow detection (/GS).
Good luck!
Re:OT, but you might know... (Score:1)
Normally, the CRT provides the raw entry point, initializes itself
Re:OT, but you might know... (Score:2)
Peace & Blessings,
bmac
Re:OT, but you might know... (Score:1)
Re:Been there, done that, no t-shirt. (Score:2)
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.
Re:Been there, done that, no t-shirt. (Score:2)
No, they're trying to convince you to use safer versions of the functions with extra parameters. You get a warning
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 e
Re:Been there, done that, no t-shirt. (Score:2)
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. Is
So, when will there be a native 64 bit IDE? (Score:2)
Do it! (Score:1)
You're a madman, and I admire it! (Score:2)
Re:IDE is Beautiful (Score:5, Informative)
Re:IDE is Beautiful (Score:3, Informative)
Re:IDE is Beautiful (Score:2, Informative)
Re:IDE is Beautiful (Score:2)
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 Microso
Re:IDE is Beautiful (Score:1)
Re:IDE is Beautiful (Score:2)
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 siz
Re:VB.Net is NOT VB 7 (Score:3, Informative)
Re:VB.Net is NOT VB 7 (Score:2)
-Rick
Whoops (Score:2)
Re:VB.Net is NOT VB 7 (Score:1)
Re:VB.Net is NOT VB 7 (Score:2)
VB.Net is not the next version of VB. Just like C# is not the next version of C++. All