domingo, 29 de março de 2020

SW Development: About C++ Adoption (in Embedded)

An article on (the lack) of the latest C++ adootion, C++ 17 and the possible reasons, and the statement that 70% of embedded systems being developed in C:

https://www.perforce.com/blog/qac/should-i-adopt-cpp17

Quoting:
"

Pros and Cons of C++17 Features

The latest version of C++ includes features that improve your code, performance, and security. While these are nice features, they're not earth-shattering. 

Algorithm Optimization

One of the biggest additions is the introduction of the parallel algorithms library.

Multi-processor systems are required for computer-intensive programs and artificial intelligence. The parallel algorithms library makes it easier to execute standardized algorithms on this type of system. 

Cleaner Code

There are two features that will enable cleaner code:

  • Selection statements with initializer.
  • Structured bindings.

This also reduces keystrokes for those who understand the syntax.

So, these features provide a step up for cleaner code. 

Interested in writing cleaner code? Get coding best practices for C++ >>

Better Performance

“Guaranteed copy elision” is designed for improved compiler optimization. So, it may improve runtime performance. 

Safety and Security

The latest C++ features will improve the safety of your program and ensure secure coding, including the following:

  • Removal of trigraphs and dynamic exception specifications.
  • Stricter order of expression evaluation. 
  • Introduction of std::byte type.

The first two features prevent unspecified or undefined behavior. 

The std::byte feature improves type safety. It distinguishes byte-oriented access to memory from accessing memory as a character or integral value. It also improves readability. The intent of the code is clearer.

Learn more about the changes from C++14 to C++17"