Embedded Systems
14.4K subscribers
1.09K photos
236 videos
1 file
749 links
News, articles, guides, analytics, projects and startups from the embedded industry.

Topics of the channel:
◽️ machine learning
◽️ internet of things
◽️ embedded software
◽️ advanced electronics
◽️ new engineering ideas

⤵️ Share and subscribe!
Download Telegram
💻 C++ Tricks for C Programmers

C++ offers developers modern tools to leverage when designing more reusable, scalable, and portable code.

▫️ Conditional Compilation Using Constexpr: The bane of many embedded code bases written in C is the large numbers of #if / #elif / #else preprocessor directives. Starting in C++ 17, the language introduced the ability for developers to conditionally compile code using constexpr.

▫️ Ranged for Loops: The C for loop has been stuck in the dark ages by not having a simplified range-based option. Starting in C++ 11, an additional version of the for loop was added that makes working with ranged values easier.

▫️ Use Auto: C developers used to use auto to specify a variable that was limited to the current scope. In C++, auto can be a very useful keyword that tells the compiler to automatically assign the datatype for the developer.

▫️ The Spaceship Operator: Just recently, C++ 20 add a three-way comparison operator <=> that can simplify readability and the code.

#articles
👍7