Making Rtems Device Drivers using C?
Angelo Fraietta
afraiett at bigpond.net.au
Wed Jan 5 04:41:53 UTC 2005
Chris Johns wrote:
> Overhead is not the issue. Joel is making a general point about C++
> and device drivers, and to be more specific drivers with interrupts.
> You need to know more about what is happening to make the code work as
> you expect.
> For example you can not throw exceptions from an ISR and catch them in
> a task, and accessing a STL container in an ISR could result in the
> code trying to lock a mutex, or there could be temporary objects that
> try to use the heap. I suspect there are more conditions.
True to a point, but that is not specific to the language. Eg, you can't
call malloc from an interrupt in C code.
>> Michael Barr, in book cited below, states that C++ is preferable due
>> to its type-safety. Overhead can be controlled by avoiding things
>> such as templates.
>>
>> 1. Barr, M., Programming embedded systems in C and C++. 1999,
>> Sebastopol, Calif.: O'Reilly. xvii, 174.
>>
>
> Not sure I agree with the last statement about templates.
The main issue I believe is code bloat. Another article is below.
http://www.embedded.com/98/9802fe3.htm
--
Angelo Fraietta
PO Box 859
Hamilton NSW 2303
Home Page
http://www.users.bigpond.com/angelo_f/
There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
Bernard of Clairvaux (1090 - 1153)
More information about the users
mailing list