Skip to main content
wlee.1
Visitor II
April 4, 2023
Question

Does STM32 use C or C++?

  • April 4, 2023
  • 2 replies
  • 11666 views

What are the main differences between using C and C++ for STM32 microcontroller programming? Which language is better suited for different use cases, and what are some factors to consider when choosing between the two for embedded system development?

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    April 4, 2023

    Sounds like a homework question..

    C++ can be bulkier, and has more demands on dynamic memory allocation.

    C++ hides complexity, C forces you to account for it and own it.

    C facilitates a lot of bad programmers, with poor habits, C++ forces a more structured and object orientated approach.

    Not all people using C have a million global variables with subtly different unique names.

    If you can't determine which is suitable for your use case, you probably need more experience.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    S.Ma
    Principal
    April 5, 2023

    C language is still the most common programming language for embedded microcontrollers.

    (beyond embedded, C is still popular, at least by TIOBE index TIOBE Index - TIOBE

    The C language spec has evolved, yet compiler adoption to the upgrades takes time.

    Comments with "//" is one example.

    Most of C++ improvements can be coded in C with less readability (structure with function pointers members....).