tags:

views:

1162

answers:

12

Of late I'm facing the issues that points finger to VC6 compiler.

Few of them are:

  1. A function-try-block doesn't work. Related Q
  2. in-class constant doesn't work.
  3. __FUNCTION_ (Macro to get function name) doesn't work
  4. The latest addition is it doesn't allow void functions to be passed as part of for_each.

The below example is not compiling with VC6 compiler. It says "error C2562: '()' : 'void' function returning a value". It looks like VC6 doesn't like void functions to be passed to for_each.

class Temp
{
public:
    Temp(int i):m_ii(i)
    {}

    int getI() const
    {
     return m_ii;
    }

    void printWithVoid()
    {
     cout<< "i = "<<m_ii<<endl;

    }
    bool printWithBool()
    {
     cout<< "i = "<<m_ii<<endl;
     return true;
    }
private:
    int m_ii;
};

int main(void) 
{
    std::vector<Temp>  arrTempObjects;

    arrTempObjects.push_back(Temp(0));
    arrTempObjects.push_back(Temp(2));

    //Doesnot work, compiler error 
    std::for_each(arrTempObjects.begin(), arrTempObjects.end(), std::mem_fun_ref(&Temp::printWithVoid));

    //Works
    std::for_each(arrTempObjects.begin(), arrTempObjects.end(), std::mem_fun_ref(&Temp::printWithBool));

    return 0;
}

Have you faced any other issues related to VC6.0. Any workaround to resolve these issues ? Or is it time to change the compiler?

+29  A: 

Quite frankly I can hardly understand why you wouldn't buy a modern computer and switch to Visual Studio 2008.

VC6 has got a deficient STL, poor C++ standard compliance and obsolete GUI.

You shouldn't let your competitors use better tools than you.

Edouard A.
Some users don't have a choice because they work at large, conservative corporations that don't always act in what we would think is their best interest. Companies with large investments in code don't give them up easily. Some are running Cobol on mainframes that's 30-40 years old.
duffymo
Its legacy project. I need to persuade my manager!
aJ
You have the choice to leave.
Edouard A.
@aJ : I would suggest to your manager that switching to vs2008 will save money : faster development, less bugs, etc.
Edouard A.
Time to perform the Monthy Python Dead Parrot sketch. "Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!"
MSalters
One unfortunate side effect -- several of our C++ apps got noticably slower when moving from VC6 to 2005/2008. (Like, 20% slower) This was after lots of work re-evaluating the compliation flags, etc. So we moved back for those products.
Joe
@Joe : I truly think this is impossible. The compiler of 2008 is way better than the one in VC6. Have you tried with SECURE_SCL=0 ?
Edouard A.
Moerover, in case financial reasons weigh in, VC++ 2008 Express is free (as in free beer).
RaphaelSP
@Joe: The culprit was probably SECURE_SCL as Edouard suggested.
jalf
+3  A: 

VC6 cannot do much of any kind of modern C++. I recall I tried to use one of the boost libraries ages ago like probably Graph and it was giving "INTERNAL COMPILER ERROR" all over the place so eventually I chucked that in.

1800 INFORMATION
It would ICE for almost anything template-ish you threw at it. Blech! Good riddance I say!
Marcus Lindblom
+2  A: 

I changed from VC++ 6.0 to Code::Blocks (which is FOSS) with g++ a few months ago and haven't really looked back. I miss the VC++ debugger a bit, as the gdb implementation in CB is nowhere near as slick, but that's about all. Some things in the IDE work better (code completion, tooltips, dependancy xalculation) and the compiler is obviously much better.

Regarding your points, function try blocks are hardly a widely used feature, and most people think they are pretty useless. And the __FUNCTION__ macro is not part of the C++ Standard, so you shouldn't depend on it too much if portability is an issue.

anon
+1  A: 

Unless you have a large program to maintain, yes. Switch today!

The Express versions of VC++ are a free download from Microsoft.

Jimmy J
+3  A: 

The no-brainer answer is yes, and ASAP. You have free alternatives like VC++ express and Code::Blocks, if the cost as in issue. The pain in solving compatibility issues is IMO no reason not to upgrade because you will have to do it some day anyway and it only gets harder.

The only reason I see for a possible obstacle is if you have MFC code that will be difficult/time consuming to port. In that case you can't use VC++ express (no support for MFC) and you have to make the investment for at least the VS std. edition. That will cost you about EUR 300 (depending on where you live).

Dani van der Meer
+1  A: 

You can learn to live with VC6s foibles. It almost has a certain retro charm these days. We've been repeatedly providing "just one last VC6 release" of some libraries to a customer for years now. Hard to argue with a customer prepared to pay for the extra work backporting and maintaining a branch. But at some point the cost for us to backport newer features developed in newer VCs will exceed the cost of them upgrading at their end (especially as more boost and Intel TBB creeps into the codebase's head). Or at least I hope that's what'll happen! Worst case it'll happen just as flaky C++0x support appears and we'll be stuck supporting that for them for 10 years...

timday
A: 

General rule seems to be that a new version is an upgrade and is thus worthwhile.

However! you have to pick the right time for it, there are so many bugs fixed, but you then need to be aware of the new bugs and variations from the standard.

Set aside time for the upgrade. Upgrading compiler versions could well be a project in its own right, make sure you have stable code and good tests before you do an upgrade and when you finish prove that it is still working the same.

You may be forced to upgrade when you start to develop for Vista as VC6 doesn't provide for code signing easily and the redist is not in a form that Vista likes. (want at least VC2K5)

Greg Domjan
A: 

Are you updating the OS any time soon? When I researched moving our apps to Vista, I found that Vista doesn't officially support anything before VS 2005 (except for VB 6), and has a page-long list of possible little problems with VS 2005 that may or may not bite you. I recommended delaying until VS 2008 SP1 was available (i.e., when VS 2008 was really usable), and doing the compiler changeover first.

If the project is a special one for a few customers who run it soley on old NT machines, you may want to keep it at VS 6. If you are selling it for any sort of general consumption, you will need to make it Vista-compatible at some point (or 7-compatible, or whatever), and you will need to upgrade.

David Thornley
+4  A: 

Well, here's the thing. The VC6 compiler sucks. However... the IDE is pretty good.

VS2005 has much better source control support. Otherwise, it's much slower debugging, has a crappy output pane that exponentially decays on inserting output lines (what absolute garbage coding is that?), the help system is many times slower, and debug and continue (possibly Microsoft's best feature over other IDEs) is considerably more broken.

.NET? Sure, VS20xx is the only way to go. However, for one small client that is sticking with VC6/MFC (for interfaces to embedded systems, etc) I actually enjoy working with VC6. It's just FAST.

2008? I'd like to... but it takes a while for my clients to migrate. Nobody has, yet.

darron
+6  A: 

Is it time to say goodbye to VC6 compiler ?

Yes.

Mark Ingram
A: 

I guess this is why so many applications on Windows sucks because people still use VC6. Why mess with broke, never maintained MFC or even Win32 when their is wxWidgets and Qt4 out there way better than MFC could ever be and you you can even use the free additions of Visual Studio 2005+

Um. Because the customer pays us money to do so?
EvilTeach
+1  A: 

No, it was time to say goodbye to it a decade ago. Here are a few reasons why:

  • There are free, standards-compliant compilers available, both from Microsoft and others
  • VC6 was written before the C++ language was standardized, and it is nowhere near standards compliant. Especially templates and the standard library live in a world of their own, with no tie to how these features actually work in ISO C++. The language it compiles is not C++. It is a hybrid of pre-standard C++, Microsoft extensions, compiler limitations and bugs. Neither of which are desirable.
  • VC6 is known to generate invalid code in some cases. Not only does it compile a home-made, buggy and nonstandard language, it also makes invalid optimizations causing crashes, or in some cases actually produces bad assembly that simply can not be executed.

It is broken, and it was always broken. It was designed to compile a language that ceased existing about the same time as the compiler was relased (when the language was standardized), and it failed even at that task, with countless bugs, some of which have been fixed in the half-dozen service packs that were released. But not all of them, and not even all the critical ones.

Of course, the downside to this is that your application is most likely just as broken. (not because you're bad programmers, but because it targets a broken compiler. It has to be broken to be accepted by VC6)

Porting that to a standards-compliant compiler is likely to be a lot of work. Don't assume that you can just import your old projects, click "build", and it'll work.

So if you're part of a big business that can't just take a month off to switch compilers, you might have to port it as a side project, while part of the team is maintaining the VC6 version. Don't scrap VC6 until you've successfully ported everything, and it works.

jalf