Re: Conversion from GCC C++ to Visual C++

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 07/28/04


Date: Wed, 28 Jul 2004 18:03:16 -0400

Dranoel wrote:
> [...]
> Thanks, as a test, I had "corrected" a few of the easy ones. The
> examples were no more than that. The issue is that it compiles elsewhere
> but not under Visual C++. I could "correct" each reported error (with
> great difficulty I suspect), but I greatly prefer to determine what setup
> of Visual C++ will VC++ compatible with gcc.

None whatsoever. Microsoft is not concerned with compatibility with
other products, even less so with free software. I don't work for
them, so this is not some kind of company policy, I just observed this
over the years.

Also, if the code uses standard C++ language, then VC++ 6.0 is not the
best tool to use. 7.1 is much, much better. So, if there is some
standard C++ construct in your code (like out-of-class definition of
a member template), VC++ v6 may not be able to handle it, and the rest
of the world probably can.

> I am not the author of the
> software; I am charged with making the conversion with only necessary
> modifications.

The modifications that make the code compile are _necessary_. If those
who hired (charged) you to move from g++ to VC++ do not understand that,
I am sorry. Mostly for you, of course.

> I am expressly forbidden to unilaterally "correct" errors
> not reported under more than one compiler.

This is utter nonsense and you can convey my sincerest condolences to
your entire development group. What you're trying to do is apparently
impossible: "I must jump off this airplane flying at 1000 feet and make
sure I survive the jump, but I am not allowed to use any parachute".

Compilers are written by people. Compilers (a) provide you with some
part of the standard functionality, unfortunately never 100%, and (b)
often contain extensions, different in different compilers. What you
eventually want to have is free of extensions codebase that only
contains some kind of common subset of standard language. Is it at all
possible? In most cases, yes. In some cases it's extremely difficult.

At any rate, when you have some codebase that was initially created for
only one compiler without concern for its transfer anywhere else, it is
full of non-compliant elements and/or extensions. You need to weed those
out no matter whether any other third-party compiler reports them as
errors or not. Your target is VC++, you need to make your code
VC++-compliant. Period.

Good luck!

Victor



Relevant Pages

  • Re: Making C better (by borrowing from C++)
    ... MS header files, or whatever, it's undefined by the standard how those ... >> possible to compile so that the method is what the compiler produces by ... all the extensions of lcc-win32 are exactly like ... is not compliant, it doesn't matter ...
    (comp.lang.c)
  • Re: non-standard functions in libc -- bad design?
    ... standard supported by a compiler/library, ... I'd call them extensions. ... gcc doesn't get a vote. ... gcc is just a compiler, ...
    (comp.lang.c)
  • Re: Making C better (by borrowing from C++)
    ... > possible to compile so that the method is what the compiler produces by ... I would have to rewrite the 15 000 APIs that Windows ... all the extensions of lcc-win32 are exactly like ... >>BY DEFINITION in the standard itself. ...
    (comp.lang.c)
  • Re: C- Programming for ARM Microcontrollers
    ... Please explain what you mean by standard C ... Depending on what you are programming and what if any portability is required often you are better sticking with a compiler implementation than the C standard. ... In real world SW engineering portability is NOT a priority for the vast majority of systems An embedded system is part of something else. ... However C code should always be written in a modular style and it does make sense to try an encapsulate areas where you talk to the hardware or use some extensions. ...
    (comp.arch.embedded)
  • Re: Compaq Visual Fortran or Intel Fortran Compiler?
    ... All of those extensions are standardized in f90 and are also ... says "well of course this is standard Fortran", ... the current compiler offerings. ...
    (comp.lang.fortran)

Loading