C++ STL in embedded systems

M

Mike Smith

ma740988 said:
With regard to the number below:

Read, sort, and write floating-point numbers

unoptimized optimized

elements C++ C C/C++ ratio C++ C C/C++ ratio

500,000 3.5 6.1 1.74 2.5 5.1 2.04
5,000,000 38.4 172.6 4.49 27.4 126.6 4.62


One of things I find interesting about the source - he used is his
comment:

buf.reserve(res); // logically redundant; for efficiency only

How is that 'logically redundant'. If you _dont_ call reserve. You'll
end up with a host of re-locations and the C++ numbers will be alot
worse. Am I missing something?

The relocations don't matter from a *logical* standpoint; i.e. from the
standpoint of *what* the program will do when executed. Sure, it
matters a great deal from a *practical* standpoint, i.e. in terms of
real-world performance, but that's not the same thing.
 
M

Mike Smith

ma740988 said:
|| std::vector::reserve() only functions to speed things up; it doesn't

|| have an effect on the result of the program.
There to speed things up but doesn't affect the result of the program!!
Not just bear with me. You're saying that if I opt not use reserve
the end result (i.e the benchmarks) would be the same?

No, but the *output of the program* would be the same. That's what was
meant by "logically redundant"; i.e. the difference is a *practical*
one, not a *logical* one.
 
W

wkaras

AD said:
I did face few issues when introducing STL in a vxWorks based
system.Major problems were:
- significant code bloat
....

It would be nice if there were alternative implementations of the
containers (especially map/set) where most of the code was non-
templated and used void * and function pointers heavily. The
templates would just be a type-safe veneer. Seems like this
approach would be a little less fast but could greatly reduce
bloat (in those bloat-sensitive situations).

Has anyone tried this?
 
D

Dietmar Kuehl

Hans-Bernhard Broeker said:
Whaddayamean, "become"? From where I sit, C++ feels like it has been
a moving target ever since its invention. Its defining standards
change faster than the implementations. Each time the implementors
finally seem to be catching up, the goal is moved.

Interesting... How many C++ standards have you come around? Sounds
like quite a lot! However, there is exactly one C++ standard and
there will be a revision which is expected around the end of this
decade. Yes, the target moves - with more than ten years of stability
between moves.
 
M

ma740988

|| Many embedded C++ compilers ship with this library.

Interesting. Went off and familiarized myself with Dinkum EC++. This
in part, because I recalled having a conversation with the vendor and
he seemed overly enthused about the fact that the lastest release of
their development environment used 'Dinkumware'. To that end, he
offered me a trade + extra cash.
Trouble is, I tend to be a little skeptical of a sale person who
doesn't do a good job of explaining to me the ' embedded ' in the
embedded version of the Dinkumware C++ compiler.


Curiousity question. What's in a name - 'Dinkumware'?
 
P

P.J. Plauger

|| Many embedded C++ compilers ship with this library.

Interesting. Went off and familiarized myself with Dinkum EC++. This
in part, because I recalled having a conversation with the vendor and
he seemed overly enthused about the fact that the lastest release of
their development environment used 'Dinkumware'. To that end, he
offered me a trade + extra cash.
Trouble is, I tend to be a little skeptical of a sale person who
doesn't do a good job of explaining to me the ' embedded ' in the
embedded version of the Dinkumware C++ compiler.


Curiousity question. What's in a name - 'Dinkumware'?

Short answer -- we spent a year in Australia. A good friend of mine
organized a visiting post for me at University of New South Wales.
Besides, we've always liked Oz. "Dinkum" is Aussie slang for
genuine, honest, or true. I thought it was a good name for a
company that made good software. (The Limited part is to keep us
humble.)

Longer answer -- One term I taught a graduate seminar in software
engineering. (I called it Remedial Software Engineering.) We had
a running case study on Dinkum Swill Pty. Ltd., a company that
supplied hog swill for most of NSW. The students found some
fascinating, and sometimes gross, uses for computers in the
production of hog swill.

A few years later, I found myself negotiating with the likes of
Microsoft and IBM for the licensing of the C++ library I'd been
developing. My wife Tana did not want me signing contracts with
such big players as a sole proprietor (quite rightly). So she
founded a company for us. I wanted to call it Dinkum Swill, but
she would have none of it. (Imagine sitting at a rosewood
conference table explaining to a bunch of suits where the name
came from.) She was willing to settle for Dinkumware, Ltd.

That was ten years ago.

HTH,

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
S

Shark

Alex said:
Are there any restrictions/problems for use of C++ STL in development
in embedded systems?
In particular:
* Does STL require too much space/memory?
* Is 'implementation of STL algorithms/methods' reenterable/reentrant?
* What is the cost to provide continuity of vectors in memory?
Any other problems?

If you are wondering about microsoft's evc++ 4.0 and above, the simple
answer is, they don't provide one due to yada yada reasons. Every
platform has its own library, and their MFC has a memory leak. You can
possibly get sources for the STL and compile them with each library for
each platform that you are working for. But it is not clear if evc++ is
truly standards conforming.
 
P

P.J. Plauger

If you are wondering about microsoft's evc++ 4.0 and above, the simple
answer is, they don't provide one due to yada yada reasons. Every
platform has its own library, and their MFC has a memory leak. You can
possibly get sources for the STL and compile them with each library for
each platform that you are working for. But it is not clear if evc++ is
truly standards conforming.

If by STL you really mean the Standard Template Library, then most
versions of eVC++ contain pretty complete implementations. (Ours, of
course.) What Microsoft has managed to do, for mysterious (yada
yada?) reasons, is butcher the combined C/C++ library in bizarre and
inventively different ways for each release of eVC++. We have a tidy
side business replacing the missing bits for those who need better
code portability between desktop and embedded versions of the same
compiler family.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
C

CBFalconer

P.J. Plauger said:
If by STL you really mean the Standard Template Library, then most
versions of eVC++ contain pretty complete implementations. (Ours,
of course.) What Microsoft has managed to do, for mysterious (yada
yada?) reasons, is butcher the combined C/C++ library in bizarre
and inventively different ways for each release of eVC++. We have
a tidy side business replacing the missing bits for those who need
better code portability between desktop and embedded versions of
the same compiler family.

The reason is obvious and consistent. Microsoft fouls existing
standards in order to lock suckers in to their own software and
systems. They have been doing this for many years. They have
fouled html with IE and Usenet with OE. More power to you if you
can replace their junk with conforming packages.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
G

Guest

Shark said:
If you are wondering about microsoft's evc++ 4.0 and above, the simple
answer is, they don't provide one due to yada yada reasons. Every
platform has its own library, and their MFC has a memory leak. You can
possibly get sources for the STL and compile them with each library for
each platform that you are working for.

First, eVC++ 4.0 includes STL implementation but very incomplete.
Second, if you'd like to use STL then you have two (three in fact) choices:
- buy Dinkumware libraries
- use STLport (here is my small introduction: http://tinyurl.com/eysea)
- write it youself :)

But it is not clear if evc++ is
truly standards conforming.

No, it isn't e.g. there is lack of template partial specialization
support and other modern C++ features.
eVC++ compiler is directly derived from VC++ 6.0 for desktop Windows.
(BTW, compilers for Windows CE platform are usually based on "big"
brothers for desktop Windows)

If you are looking for ANSI/ISO C++ compliant compiler for Windows CE
then you better take a look at Visual C++ 2005 (8.0).
Here is my small analysis I write to encourage myself to
move to VC++ 8.0 :)

http://mateusz.loskot.net/2005/12/2...ompliant-to-c-standards-regarding-windows-ce/

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top