On (15 May 97) Louis Rizzuto wrote to Carey Bloodworth...
LR> Is it plausible to write such RT apps in C++ - and still meet real
LR> time criteria? I am not sure. Perhaps some else here can comment
LR> on this.
Yes. There's not a lot of difference between doing RT programming in
C and in C++. In both cases, there are some obvious restrictions such
as on using dynamic memory allocation unless your library has an
allocator with know worst-case speed.
One thing that does change is that typical C++ programs _do_ tend to use
dynamic allocation more than their C counterparts, at least in my
experience. Likewise, it's not necessarily as easy to "see" which
things are likely to consume time by examining source code. For
instance in C an assignment statement:
a = b;
is always going to be relatively simple and straightforward. About the
only time it's going to consume significant time is if `a' and `b' are
struct's of relatively large size.
However, in C++, that same assignment statement might disguise an
arbitrary amount of complex code, and may well involve a number of
function calls.
However, in both cases things come out more or less the same in any
case: you've got to find your absolute worst-case path through the code
and you've got to verify that it's within requirements.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|