473,804 Members | 3,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C or C++ for embedded system plug-in?

I want to produce a piece of software for embedded systems, generally
telecoms based, mostly running on ARM processors, but I can't guarantee
that, of course.

My software should work along with other software which will generally
be written in C or C++ (occasionally in ADA or even assembler).

I suppose that there are C compilers for marginally more processors
than C++, but, realistically, I am not sure that it makes a major
difference.

I suppose that C produces slightly smaller and faster code, but wonder
if it makes a major difference.

I like C++ exception handling (but know 6that it adds an overhead). I
have clearly defined interfaces and interfacing software would gain
nothing really by instantiating any classes, if I used C++

I want to genericize functionality which the host software ought to
provide, so that I can use their memory allocation routines, timers,
debug tracing, etc, etc - probably just by offering some #defines,
which they can change in a single header file, as necessary - but any
advice is welcome.

I think that I am leaning towards C, but am open to input ...

Thanks in advance for any help.

Jan 3 '07
42 2370
Henryk wrote:
We made very good experience with C++ on embedded systems even for time
critical tasks.
<snip>
The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...
What typical C memory access errors?

Jan 4 '07 #21

santosh schrieb:
Henryk wrote:
We made very good experience with C++ on embedded systems even for time
critical tasks.
<snip>
The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

What typical C memory access errors?
You know what I mean ... ;o)

All those little pitfalls due to messing around with pointers. Using
references and proper initialized objects in C++ can avoid most of
these errors and saves us from checking pointers again and again for
validity when handed around within an application...

Of course you can mess around with references too but its much harder
to do so just by accident.

Henryk

Jan 4 '07 #22
On 4 Jan 2007 08:56:55 -0800, "Henryk" <he************ @gmx.dewrote:
>
santosh schrieb:
>Henryk wrote:
We made very good experience with C++ on embedded systems even for time
critical tasks.
<snip>
The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

What typical C memory access errors?

You know what I mean ... ;o)

All those little pitfalls due to messing around with pointers. Using
references and proper initialized objects in C++ can avoid most of
these errors and saves us from checking pointers again and again for
validity when handed around within an application...
Sounds like a poorly designed application.
>
Of course you can mess around with references too but its much harder
to do so just by accident.
Maybe that's the difference. I don't write code by accident.

--
Al Balmer
Sun City, AZ
Jan 4 '07 #23
Henryk a écrit :
santosh schrieb:

>>Henryk wrote:
>>>We made very good experience with C++ on embedded systems even for time
critical tasks.

<snip>
>>>The resulting software is very modular and and code is easy to read. We
almost never had any of those typical C memory access errors...

What typical C memory access errors?


You know what I mean ... ;o)

All those little pitfalls due to messing around with pointers. Using
references and proper initialized objects in C++ can avoid most of
these errors and saves us from checking pointers again and again for
validity when handed around within an application...

Of course you can mess around with references too but its much harder
to do so just by accident.

Henryk
That's why I inroduced references in lcc-win32 C compiler

jacob
P.S. flames >/dev/null
Jan 4 '07 #24
jacob navia wrote:
>
.... snip ...
>
That's why I inroduced references in lcc-win32 C compiler
How do you disable them, and ALL the other extensions?

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #25
Henryk wrote:
>
We made very good experience with C++ on embedded systems even for
time critical tasks.

For our system we restricted the C++ features that are allowed.
Those are:
- no dynamic memory allocation (no new, delete, malloc, free etc.)
- no exceptions
- no run time type information
- no virtual functions
- no templates

Some of the restrictions were due to the first platform we used
(compiler did not support templates) others were choosen to
increase robustness and speed.

The resulting software is very modular and and code is easy to read.
We almost never had any of those typical C memory access errors...

The great benefits of C++ over C in this projects are:
- excessive usage of references instead of pointers makes the code
very robust
- excessive usage of const classifiers avoids mis-usage of objects
- class access rights + lightweight inline methods (set, get) assure
protection of internal module variables. Old projects were full of
those evil extern declarations...
- constructors assure proper initialized modules
- all of those features above come with virtual no runtime overhead.

One of the disadvantage of C++ is a slightly greater memory footprint
because C++ environment initialization is more sophisticated.. .

I really like the beauty of our lightwight wrappers for hardware
interfaces. Almost no runtime-overhead, intuitive usage, and very
robust against abuse at the same time. Much better than anything
that you can achieve in C.

Our experience with C++ on embedded systems were so good that we use C
only for those platform that does not provide a proper C++ compiler.
Why did you post this 3 times? Usenet is not an instantaneous
medium. Time to propagate ranges from millisecs to infinity.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
Jan 5 '07 #26
CBFalconer said:
jacob navia wrote:
>>
... snip ...
>>
That's why I inroduced references in lcc-win32 C compiler

How do you disable them, and ALL the other extensions?
One surefire method would be to use gcc (avec incantations).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jan 5 '07 #27
CBFalconer a écrit :
jacob navia wrote:

... snip ...
>>That's why I inroduced references in lcc-win32 C compiler


How do you disable them, and ALL the other extensions?
No need to disable them, since you use them only if
you explicitely write
int &a = b;

You just do not use that.
Jan 5 '07 #28
jacob navia wrote:
CBFalconer a écrit :
jacob navia wrote:
... snip ...
>That's why I inroduced references in lcc-win32 C compiler
How do you disable them, and ALL the other extensions?
No need to disable them, since you use them only if
you explicitely write
int &a = b;

You just do not use that.
But there should be a mode in which the compiler produces a diagnostic
and possibly halts compilation for sources having non-C90 and/or
non-C99 constructs.

For lcc-win32 what are the switches or flags which turn on this
behaviour?

Jan 5 '07 #29

CBFalconer schrieb:
Henryk wrote:

We made very good experience with C++ on embedded systems even for
time critical tasks.

For our system we restricted the C++ features that are allowed.
Those are:
- no dynamic memory allocation (no new, delete, malloc, free etc.)
- no exceptions
- no run time type information
- no virtual functions
- no templates

Some of the restrictions were due to the first platform we used
(compiler did not support templates) others were choosen to
increase robustness and speed.

The resulting software is very modular and and code is easy to read.
We almost never had any of those typical C memory access errors...

The great benefits of C++ over C in this projects are:
- excessive usage of references instead of pointers makes the code
very robust
- excessive usage of const classifiers avoids mis-usage of objects
- class access rights + lightweight inline methods (set, get) assure
protection of internal module variables. Old projects were full of
those evil extern declarations...
- constructors assure proper initialized modules
- all of those features above come with virtual no runtime overhead.

One of the disadvantage of C++ is a slightly greater memory footprint
because C++ environment initialization is more sophisticated.. .

I really like the beauty of our lightwight wrappers for hardware
interfaces. Almost no runtime-overhead, intuitive usage, and very
robust against abuse at the same time. Much better than anything
that you can achieve in C.

Our experience with C++ on embedded systems were so good that we use C
only for those platform that does not provide a proper C++ compiler.

Why did you post this 3 times? Usenet is not an instantaneous
medium. Time to propagate ranges from millisecs to infinity.
Sorry about that! My network browser did not respond so I thought it
was not sent. I deleted the posts later, but maybe this works only in
the google groups...

Henryk

Jan 5 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
342
by: Peter Zentner | last post by:
Hi, I have a bitmap as an embedded resource. Now I want to use that bitmap for a background image of a button. But if I do the following it doesn't work. <snap start> Dim s As System.IO.Stream = Me.GetType().Assembly.GetManifestResourceStream("WindowsApplication1.Bitmap1 ..bmp") Dim bmp as bitmap = New Bitmap(s)
2
2201
by: | last post by:
Where can I find a minimal version of python (less than 2 MB) suitable for a web server on an embedded linux system? The small size is required because the system lives on flash memory. Thanks, Ken Seehart
2
12171
by: Jani Mantytorma | last post by:
I have embedded resource called Settings.xml. I'm able to read the resource but how can I write data to the resource. The code for read operation follows: private XmlDocument m_doc = new XmlDocument(); System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream stream = a.GetManifestResourceStream(this.GetType(),"Settings.xml"); if(!(null==stream)) { System.IO.StreamReader rdr = new...
2
1895
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML files. My application will load the resources into memory as they are needed. I would like to be able to read and write to these embedded resources. Is it possible to write to an embedded resource within an assembly? If so, how? If it's not...
0
2352
by: BattleAngel444 | last post by:
Hi All I am trying to run the Postgres 8.0 intaller on my XP embedded (XPe) build. I get to the point where it runs initdb.exe but it ends up failing and does not install. I believe i am possible missing a system file or service but i don't know. To me it seems like the postgres installer comes with its own system files. below is a link to a thread with what i believe is the same problem. ...
0
6504
by: garethrichardadams | last post by:
Hello all, I've added a font to my project and set it to "Embedded Resource". I load the font into a global PrivateFontCollection. (InitCustomFont - shown below) I then set the font of a label to be equal to the custom font (SetCustomFont - shown below)
2
1381
by: Peter van der veen | last post by:
Hi I have a VB project and added a text file to it as an embedded resource. But i can'f find a way now how to read this file just as a normal text file with the streamreader command. Anyone can give me a hint?
1
1928
by: mark | last post by:
I'm using System.Net.Mail to send HTML email. I have a few images embedded within the HTML body. What's the most efficient way of including these images with the message or getting the images to display on recipient's client? Obviously, I want to avoid spam filters and don't want to hog bandwidth. Any help much appreciated.
7
34932
by: Morias | last post by:
I have been trying to install a Zebra LP2844 on a computer running Windows XP. When using the add printer wizard I get an error that simply tells me "The printer could not be installed," but when using the plug and play auto detect wizard I get the error "Data area passed to a system call is too small." The printer has worked on this particular computer before, but when it started malfunctioning I tried reinstalling the drivers and that is when...
4
6392
by: tvnaidu | last post by:
Porting small application from windows to embedded system, not decided what to use whether RTOS or Embedded Linux, is there big difference between RTOS and embedded Linux?. also I need to reduce the C code size (during development all debugging symbols are visible), for final product, I don't need all debugging symbols, I need to turn off all those symbols, can I reduce code size for final product?. also I have to write a library which...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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,...
0
10338
jinu1996
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...
1
10323
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,...
0
10082
tracyyun
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...
1
7622
isladogs
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...
0
6856
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();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.