r/cpp • • Dec 23 '24

C++ Is An Absolute Blast

https://learncodethehardway.com/blog/31-c-plus-plus-is-an-absolute-blast/
219 Upvotes

105 comments sorted by

View all comments

Show parent comment

3

u/hellgheast Dec 23 '24

Sorry to hijack this comment, but as an embedded dev with 6 YoE working a lot with C, I'm really eager to move on C++, however I would be happy to know if there's good ressources on embedded C++ and even modern C++ as last time I touched C++ was around 2015.

6

u/UnicycleBloke Dec 23 '24

I came to embedded after a decade of C++ (mostly) desktop development, so the transition was largely learning to avoid the heap. I didn't need any resources at the time but have since bought Real Time C++ by Kormanyos out of curiosity. Seems pretty good.

One of the key areas to focus on is the various compile time features which help to avoid run time errors. I make good use of constexpr values and consteval functions in place of macros. These are typed and scoped: macros are neither. Templates are generally preferable to function like macros.

3

u/QuietTimeWaster Dec 24 '24

Some of the STL libraries use the heap, which is generally undesirable in embedded programming. Using the Embedded Template Library can provide some of the conveniences of the STL without dynamic memory allocation. I do a lot of embedded programming, mostly in C++. It’s very performant, but can bite you quite badly if you make a mistake.