Using C++ in device drivers

Dear RIOT developers, What are your opinions on writing device drivers or system modules in C++? I know some of the more constrained platforms might not yet have C++ support, but still it might be an interesting option for some device drivers. C++ objects for example can be used as an alternative to the device descriptor pattern we are using in many drivers.

I don't have any particular driver in mind, I just want to hear any opinions around the community.

Joakim Gebart Eistec AB www.eistec.se

Hey,

What are your opinions on writing device drivers or system modules in C++?

Well, there are probably many things that could be written with more concise code or with less duplication in C++.

But I still think that the base system should be plain C, to keep it more portable, to better understand how stuff interacts, to "know what's going on" under the hood, to more easily understand where our precious bytes get eaten, ...

So I'd be reluctant to change any of the core interfaces to use C++.

Kaspar

Hi,

What are your opinions on writing device drivers or system modules in C++?

Please under no circumstances. Is there something worse, how about APL or Pascal? :slight_smile:

I know some of the more constrained platforms might not yet have C++ support, but still it might be an interesting option for some device drivers. C++ objects for example can be used as an alternative to the device descriptor pattern we are using in many drivers.

What's wrong with the "device descriptor"? Is the CPP Object something else? The scope in which CPP would be used for RIOT, is just an extension of C with poor readability and design.

I don't have any particular driver in mind, I just want to hear any opinions around the community.

It is noteworthy that this discussion occurs repeatedly in open source projects. It's pretty much my opinion about CPP (except for verbal abuse): http://harmful.cat-v.org/software/c++/linus

And that is also interesting: http://harmful.cat-v.org/software/c++/coders-at-work

Hi,