Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why isn’t the SDK written in C++?

This may be an unpopular question but the Nordic SDK seems to go to great length to perform what is effectively object-oriented programming while still avoiding c++. This leads to, among other things, an overly complex sdk rife with macro string concatenation and other evils. In our project we spent the first six months wrapping every part of the sdk into a coherent object model. The wrapping was painful but paid off dividends when we went to actually do the real work. 

Hopefully I don’t need to extol the virtues of c++ in embedded systems. Others have already done that for years: https://www.embedded.com/design/programming-languages-and-tools/4438660/Modern-C--in-embedded-systems---Part-1--Myth-and-Reality

Has Nordic considered this?  It would make your products much more attractive, at least to us. 

Parents
  • There are some counter arguments

    • C++ APIs can be hard or impossible  to use for non-standard languages, say PASCAL.
    • C++ ABI is not stable accross compiler versions, and some parts of the SDK is shipped in binary (NFC, uECC, SoftDevice)

    Also, the SDK is intended as a reference implementation for all the peripherials - to teach developers how to use them. Thus it needs to be relatively simple and easy to understand - and some hw devs may simply not understand C++ properly. Look at some of the questions in this forum...

    Much of the SDK is very closely tied to the hardware itsef. The C compiler is used as an "assembler with more macros" rather than a high level language.

Reply
  • There are some counter arguments

    • C++ APIs can be hard or impossible  to use for non-standard languages, say PASCAL.
    • C++ ABI is not stable accross compiler versions, and some parts of the SDK is shipped in binary (NFC, uECC, SoftDevice)

    Also, the SDK is intended as a reference implementation for all the peripherials - to teach developers how to use them. Thus it needs to be relatively simple and easy to understand - and some hw devs may simply not understand C++ properly. Look at some of the questions in this forum...

    Much of the SDK is very closely tied to the hardware itsef. The C compiler is used as an "assembler with more macros" rather than a high level language.

Children
Related