There’s something about classes that is appealing. While functional programming advocates will disagree, encapsulating functionality and data in an object is elegant. It also makes for easily reusable code.
But when you generate code for an STM32 microcontroller in STM32CubeMX what do you get? C. Which is fine.
In the context of microcontroller firmware, C is fast, compact and efficient. Nothing wrong with that. I am not a computer scientist, I’m not even a real programmer (I just cosplay one) but if you are then you might like to chime in with a comment about whether using C++, and particularly classes, bloats code and makes performance suffer.
Not that it matters. I’m going to use it anyway because I like it. Much of my AVR coding makes heavy use of classes that I employ across multiple projects. The same goes for the Arduino world, and if it’s good enough for them then who am I to argue?
I believe that STM32CubeIDE allows for creating C++ projects. I tried firing it up to check but it crashed. In any case, that’s neither the way I roll when it comes to coding nor is it ST’s recommended approach. The company is now focusing on VS Code, as am I.

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.