Topic: Q: Portability for C VS C++


Author: jcoffin@taeus.com (Jerry Coffin)
Date: 1998/04/25
Raw View
In article <353F9105.60995F1F@uni-scape.com>, lchow@uni-scape.com
says...
> I'm deciding between programming in C or C++ in my coming project.
> I would like to use C++ for the benefits of Object Oriented
> Programming.  However, I heard that C++ may not be as portable as C.  Is
> it true?  Any technical documentations or proofs?

Rather than being concerned with portability in general, to mean much,
you need to define your initial targets (i.e. the ones you have to
support now) and your secondary targets -- the ones you anticipate
supporting sometime soon.

Most programs _have_ to do things that aren't maximally portable.
Therefore, it's largely a matter of figuring out what portability you
need, and ensuring it's supported.  For example, if you're writing a
program that uses a GUI, portability of the GUI code is likely to be
fairly difficult, but you're likely to have no trouble finding a C++
compiler for almost any platform that has a GUI.

OTOH, if you were writing some code for an embedded controller, and
were concerned that you might use a different CPU eventually, the
situation would change quite a bit: you'll find that quite a few
embedded controllers support C but not C++.  In many cases, even the
version of C that's supported is rather minimal.

--
    Later,
    Jerry.

The Universe is a figment of its own imagination.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Lisa Chow <lchow@uni-scape.com>
Date: 1998/04/24
Raw View
I'm deciding between programming in C or C++ in my coming project.
I would like to use C++ for the benefits of Object Oriented
Programming.  However, I heard that C++ may not be as portable as C.  Is
it true?  Any technical documentations or proofs?

Thanks in advance,
lisa
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: paul@mbed.com (Paul Hamilton)
Date: 1998/04/24
Raw View
In article <353F9105.60995F1F@uni-scape.com>, Lisa Chow
<lchow@uni-scape.com> wrote:

> I'm deciding between programming in C or C++ in my coming project.
> I would like to use C++ for the benefits of Object Oriented
> Programming.  However, I heard that C++ may not be as portable as C.  Is
> it true?  Any technical documentations or proofs?
>

I think the benefits of OO outway any lack of portability.

There is a very good compiler, GNU C++ which is implemented on most
platforms and is quite robust. If you were concerned with portability,
then you could choose to use this compiler.

Otherwise, you should be quite safe using any of the latest C++ compilers
on the various platforms. If they support STL, templates, RTTI and
exception handling, then they must be recent enough to provide
portability.

We are close to a standard with C++, and although there are various
features that may or may not be available, the core language has shown to
be quite portable.

It all depends on what you do. You will have more problems with the
portability of user-interface stuff, ie etc than with the language itself.

Day to day I am using Visual C++ and Metrowerks CodeWarrior on the very
same source (with an abstracted UI). No problems.

I have also built completely portable code for CodeWarrior, Gnu C++ and
Visual C++ for another project (a CGI program). Also no major problems.

Paul.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]