Op 26-Jan-11 12:30, James Kanze schreef:
That's not been my experience. I've moved several large (500
KLoc or more) applications from Windows or Solaris to Linux,
with no real problems. Given the way the language has evolved,
it's often been more work to move to a more recent version of
the compiler than to move from Windows to Unix.
In my experience that depends highly on the type of application and
whether or not it was designed with portability in mind. If a C++
application interacts with the outside world in in other ways than just
stdin/-out and basic file I/O, it becomes non-portable real quickly.
Many applications do require services that are not provided by the
standard library, and therefore have to either make direct OS calls use
a library.
At the beginning of this century I was involved with project which had
to support three different target platforms. Like many (probably most)
C++ applications we did require services that the standard library did
not provide. To isolate ourselves from platform specific issues we tried
to use libraries that were available for multiple platforms and
libraries that provided a platform independent interface for things like
networking.
The first problem we had was that for some services there were simply no
libraries that supported the combination of OS + compiler we needed, or
in other cases the few that did support the required platforms were
severely lacking in other aspects. (don't get me started on each C++
library having its own string and container classes). The second problem
we ran into was that we had to use different C++ compilers for the
various platforms. No C++ compiler we had to use at the time was very
standard compliant; each compiler supported a different subset of C++
standard and worse, certain parts that were supported on all compilers
behaved differently. Unfortunately the only way to figure what the safe
subset of C++ was, was finding it out the hard way.
These days things have improved with (much) better standard compliance
of the C++ compilers and more mature multi-platform libraries. However
these days it is not uncommon for projects to use code that was written
over a decade ago. Porting C++ code that is not written with portability
in mind (which might have been impractical at the time) is a lot more
involved that just recompiling it for a different platform. And even if
it was written with portability in mind you might be in for a couple of
nasty surprises.