 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Metaosp Guest
|
Posted: Sat Feb 25, 2006 1:06 pm Post subject: How portable is C++ today |
|
|
Hi,
When it comes to code portability, most people would think C is a better
choice then C++. That was probably true 5 or 10 years ago, but how
about today? Are there still many platforms or devices that have no
good C++ compiler? C++ offers a lot more then C, would you use it to
build a new cross-platform project that will support a wide range of
platforms, say from handheld devices to multi-nodes servers?
--
Metaosp |
|
| Back to top |
|
 |
Moonlit Guest
|
Posted: Sat Feb 25, 2006 2:06 pm Post subject: Re: How portable is C++ today |
|
|
Hi,
Standard C++ is very portable. I develop mostly for unix (g++ version > 3.)
like systems but I never have a problem compiling the code (MS-VC++ 2003 and
later) on windows. However as soon as you start to use system specific stuff
threading/mutexes/micro timers or windowing systems than you likely do have
a small or large portability problem. It would be great if C++ (and C) would
add multi threading and micro timers to the standard libraries since I think
a lot of modern systems need or use them in some way.
--
Regards, Ron AF Greve
http://moonlit.xs4all.nl
"Metaosp" <metaosp (AT) gmail (DOT) com> wrote in message
news:1140870891.20935.21.camel@jupiter...
| Quote: | Hi,
When it comes to code portability, most people would think C is a better
choice then C++. That was probably true 5 or 10 years ago, but how
about today? Are there still many platforms or devices that have no
good C++ compiler? C++ offers a lot more then C, would you use it to
build a new cross-platform project that will support a wide range of
platforms, say from handheld devices to multi-nodes servers?
--
Metaosp
|
|
|
| Back to top |
|
 |
loufoque Guest
|
Posted: Sat Feb 25, 2006 3:06 pm Post subject: Re: How portable is C++ today |
|
|
Metaosp a écrit :
| Quote: | When it comes to code portability, most people would think C is a better
choice then C++.
|
Tools exist to convert C++ code to C. |
|
| Back to top |
|
 |
loufoque Guest
|
Posted: Sat Feb 25, 2006 6:06 pm Post subject: Re: How portable is C++ today |
|
|
Default User a écrit :
| Quote: | Those don't usually produce any kind of C code that can be used by
humans successfully.
|
Indeed, put that's not the point.
The point is to compile C++ code on a platform that only has a C compiler. |
|
| Back to top |
|
 |
Default User Guest
|
Posted: Sat Feb 25, 2006 6:06 pm Post subject: Re: How portable is C++ today |
|
|
loufoque wrote:
| Quote: | Metaosp a écrit :
When it comes to code portability, most people would think C is a
better choice then C++.
Tools exist to convert C++ code to C.
|
Convert? Not really. There are some compilers that will compile to C.
Those don't usually produce any kind of C code that can be used by
humans successfully.
Brian |
|
| Back to top |
|
 |
Nick Keighley Guest
|
Posted: Sat Feb 25, 2006 7:06 pm Post subject: Re: How portable is C++ today |
|
|
I've de-top posted this
Moonlit wrote:
| Quote: | "Metaosp" <metaosp (AT) gmail (DOT) com> wrote in message
When it comes to code portability, most people would think C is a better
choice then C++. That was probably true 5 or 10 years ago, but how
about today? Are there still many platforms or devices that have no
good C++ compiler? C++ offers a lot more then C, would you use it to
build a new cross-platform project that will support a wide range of
platforms, say from handheld devices to multi-nodes servers?
Standard C++ is very portable.
|
I understood (and I'm no expert) that some of the more esoteric
template stuff was not universally supported. For instance this page
from Boost:
http://www.boost.org/status/compiler_status.html
| Quote: | I develop mostly for unix (g++ version > 3.)
like systems but I never have a problem compiling the code (MS-VC++ 2003 and
later) on windows. However as soon as you start to use system specific stuff
threading/mutexes/micro timers or windowing systems than you likely do have
a small or large portability problem. It would be great if C++ (and C) would
add multi threading and micro timers to the standard libraries since I think
a lot of modern systems need or use them in some way.
|
--
Nick Keighley |
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Sat Feb 25, 2006 8:06 pm Post subject: Re: How portable is C++ today |
|
|
Default User wrote:
| Quote: | loufoque wrote:
Metaosp a écrit :
When it comes to code portability, most people would think C is a
better choice then C++.
Tools exist to convert C++ code to C.
Convert? Not really. There are some compilers that will compile to C.
|
And what exactly is the difference?
| Quote: | Those don't usually produce any kind of C code that can be used by
humans successfully.
|
So? |
|
| Back to top |
|
 |
heinz Guest
|
Posted: Sun Feb 26, 2006 5:06 am Post subject: Re: How portable is C++ today |
|
|
| Quote: | It would be great if C++ (and C) would add multi threading
and micro timers to the standard libraries since I think
a lot of modern systems need or use them in some way.
|
That would have been really, really nice 20 years ago, but today we
really need direct keyboard control (rather than echo'd input streams)
and also graphical display (rather than typewriter like text out) as
well.
A truly portable C++ application can be little other than a crude
command line tool. This isn't the kind of application your typical user
runs today. To realize portability with C++, it is up to the developer
to partition projects into portable and non-portable sections and use
things in the standard whenever there is a choice versus platform
specific API's or compiler extensions. Tuning the architecture to
maximize portability is not free and takes time, but it is an
investment that pays dividends in the end. |
|
| Back to top |
|
 |
Moonlit Guest
|
Posted: Sun Feb 26, 2006 12:06 pm Post subject: Re: How portable is C++ today |
|
|
Hi,
You assume that every program has a user interface. Actually the programs I
usually write don't. And still then, I can use a lot of the classes I write
in windows application. Sockets, logging etc. these are all common amongst
unices and ms-windows.
And we do need multithreading, microtimers and the lot in today's windows
applications and daemons etc.. Multithreading isn't exactly a technology of
twenty yeears ago it is something that get's used more and more (for
isnstance to separate the event-handling thread (that handles gui messages)
and doing heavy duty stuff in the background ).
Regards, Ron AF Greve
http://moonlit.xs4all.nl
"heinz" <heinz_baer@my-deja.com> wrote in message
news:1140929685.470167.309450 (AT) z34g2000cwc (DOT) googlegroups.com...
| Quote: | It would be great if C++ (and C) would add multi threading
and micro timers to the standard libraries since I think
a lot of modern systems need or use them in some way.
That would have been really, really nice 20 years ago, but today we
really need direct keyboard control (rather than echo'd input streams)
and also graphical display (rather than typewriter like text out) as
well.
A truly portable C++ application can be little other than a crude
command line tool. This isn't the kind of application your typical user
runs today. To realize portability with C++, it is up to the developer
to partition projects into portable and non-portable sections and use
things in the standard whenever there is a choice versus platform
specific API's or compiler extensions. Tuning the architecture to
maximize portability is not free and takes time, but it is an
investment that pays dividends in the end.
|
|
|
| Back to top |
|
 |
Chameleon Guest
|
Posted: Mon Feb 27, 2006 12:06 am Post subject: Re: How portable is C++ today |
|
|
Moonlit wrote:
| Quote: | Hi,
Standard C++ is very portable. I develop mostly for unix (g++ version > 3.)
like systems but I never have a problem compiling the code (MS-VC++ 2003 and
later) on windows. However as soon as you start to use system specific stuff
threading/mutexes/micro timers or windowing systems than you likely do have
a small or large portability problem.
|
| Quote: | It would be great if C++ (and C) would
add multi threading and micro timers to the standard libraries since I think
a lot of modern systems need or use them in some way.
|
I believe, companies must agree to a third-party API libraries which
must be implemented in all OS platforms. (like OpenGL in 3d graphics, or
MIDP 2.0 on mobile phones)
However, a compiler for an 8-bit microcontroller and an OS for x86
processors cannot have the same API. |
|
| Back to top |
|
 |
Chameleon Guest
|
Posted: Mon Feb 27, 2006 12:06 am Post subject: Re: How portable is C++ today |
|
|
loufoque wrote:
| Quote: | Metaosp a écrit :
When it comes to code portability, most people would think C is a better
choice then C++.
Tools exist to convert C++ code to C.
|
Wrong. Not in human readable form.
btw, this decreases optimization from C++ compiler. |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Feb 27, 2006 10:06 am Post subject: Re: How portable is C++ today |
|
|
Rolf Magnus wrote:
| Quote: | Default User wrote:
loufoque wrote:
Tools exist to convert C++ code to C.
Convert? Not really. There are some compilers that will compile to C.
And what exactly is the difference?
|
Expectations. I'd expect a converter to convert // to /* */ . I'd
expect a compiler
to strip them outright. Same goes for every other preprocessor entity.
Since
that includes headers, the output of the compiler could be usable on
only that
precise machine, with precisely the one C compiler installed there.
HTH,
Michiel Salters |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|