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 11 1988
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" <me*****@gmail. com> wrote in message
news:1140870891 .20935.21.camel @jupiter... 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
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.
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.
Those don't usually produce any kind of C code that can be used by
humans successfully.
Brian
Default User a écrit : 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.
I've de-top posted this
Moonlit wrote: "Metaosp" <me*****@gmail. 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
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
Default User wrote: 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?
Those don't usually produce any kind of C code that can be used by humans successfully.
So?
> 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.
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" <he********@m y-deja.com> wrote in message
news:11******** **************@ z34g2000cwc.goo glegroups.com.. . 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.
Moonlit wrote: 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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Vorbrodt |
last post by:
Hi there. Is this code portable between platforms? Is it also 100% standard
compliant?
#include <iostream>
using namespace std;
class Point {
public:
enum COORDS { X = 0, Y, Z };
Point(int x, int y, int z) : _x(x), _y(y), _z(z) {}
|
by: Xah Lee |
last post by:
Jargons of Info Tech industry
(A Love of Jargons)
Xah Lee, 2002 Feb
People in the computing field like to spur the use of spurious jargons.
The less educated they are, the more they like extraneous jargons, such
as in the Unix & Perl community. Unlike mathematicians, where in
mathematics there are no fewer jargons but each and every one are
|
by: Mark Shelor |
last post by:
Problem: find a portable way to determine whether a compiler supports
the "long long" type of C99.
I thought I had this one solved with the following code:
#include <limits.h>
#ifdef ULONG_LONG_MAX
|
by: Robert Bachmann |
last post by:
Two years I wrote a simple cesar encryption program, it worked but it
relied on ASCII.
So today I tried to make an portable cesar encryption.
Please tell me if the code below is really protable.
Thanks in advance.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
|
by: Ken Turkowski |
last post by:
The construct
(void*)(((long)ptr + 3) & ~3)
worked well until now to enforce alignment of the pointer to long
boundaries. However, now VC++ warns about it, undoubtedly to help things
work on 64 bit machines, i.e. with 64 bit pointers.
In the early days of C, where there were problems with the size of int
being 16 or 32 bits, the response was that an int was guaranteed to hold
a pointer (yes, there were 64Kb address spaces at one time!)....
| |
by: ibic |
last post by:
Just curious: is it possible to recursively list all the
directorys/files inside a given directory using standard c i/o library
routines only, which can be re-compiled and run on any os supportes c
compiler? Or this is too os dependent, system-specific functions must
be called?
I think about this when i tried to do this under windows, i found in
order to achieve this, some windows-specific api such as
FindFirstFile, FindNextFile must be...
|
by: pemo |
last post by:
Is C really portable? And, apologies, but this is possibly a little OT?
In c.l.c we often see 'not portable' comments, but I wonder just how
portable C apps really are.
I don't write portable C code - *not only* because, in a 'C sense', I
|
by: lovecreatesbeauty |
last post by:
On gcc, which version of C standard has the most compliant: -c89, -ansi
or c99? For more portable C code, which options should be applied to
compilation?
Can the following options guarantee the most portable C code for
different environment?
gcc -ansi -pedantic -Wall test.c
|
by: Bill Reid |
last post by:
This is how I handle a check that the last character of a text
file is a newline:
/* checks if newline is last character of text file */
unsigned check_text_file_newline_termination(FILE *test_file) {
int end_char;
fseek(test_file,-1L,SEEK_END);
end_char=getc(test_file);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |