Skip to main content
CTapp.1
Senior III
May 8, 2024
Solved

C23 support

  • May 8, 2024
  • 4 replies
  • 1920 views

Are there any plans to upgrade STM32CubeIDE to include support for C23?

It would be nice to have as it brings things like constexpr in, which makes the use of constants much better as they are subject to compiler checking and can call (constexpr) functions.

Best answer by Semer CHERNI

Hello @CTapp.1 

First let me thank you for posting and sorry for the late reply.

The C+23 features are available from the GCC 13 which is not supported via STM32CubeIDE.
The request is raised internally for further analysis.

KR,
Semer.

4 replies

Semer CHERNI
ST Employee
June 3, 2024

Hello @CTapp.1 

First let me thank you for posting and sorry for the late reply.

The C+23 features are available from the GCC 13 which is not supported via STM32CubeIDE.
The request is raised internally for further analysis.

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Explorer II
July 9, 2025

Would be really nice to have at least GNU extensions for C23 (`-std=gnu2x`).

Code like so: `int x = 0b00010000` or so: `int x = {}` produces warnings with `-Wpedantic` options, which is less than ideal, given that this is valid C and compiler recognize it and compiles just fine.

I believe the only bit missing here is the compiler flag set. If i add this flag in "Miscellaneous" then code compiles without warnings.

But the best would be indeed to have proper GCC13, GCC14 or even GCC15, and IMO would be also great to have C++23 support even if it is yet incomplete.

Pavel A.
Super User
July 10, 2025

@alt Before C23 syntax 0b.... is a GNU extension. So compile with -std=gnu*** .

Explorer II
July 12, 2025

I'm just saying that it would be good to have GNU's C2X available in settings

Right now the top available C revisions are ISO C18 and GNU18, i need to set `-std=gnu2x` manually in "Miscellaneous" and unset C revision in "General" to "GCC default".

This is not a very obvious way to do that, GNU2X would be more obvious way to select the latest C revision available, given that compiler provided with toolchain support it anyway, and there are other GNU extension in the list as well, but not the GNU2X.

Visitor II
May 19, 2026

STM32CubeIDE itself doesn’t directly control C23 support; it depends on the bundled ARM GCC toolchain, which is still gradually adding C23 features and is usually a bit behind the latest releases for stability reasons. Even today, you can often enable partial C23 support using flags like -std=c2x, or by upgrading to a newer external arm-none-eabi-gcc toolchain, but full and stable C23 support isn’t officially a CubeIDE focus yet. Also, it’s worth noting that constexpr is actually a C++ feature, not part of C, so if your goal is compile-time evaluation and safer constants, switching critical parts of your STM32 project to C++ (while keeping HAL in C) is currently the more practical and widely used approach.

CTapp.1
CTapp.1Author
Senior III
May 19, 2026

constexpr is part of C23 (it was introduced through N3018). However, it only works with objects for now (this explains why).

I've just started a project using the STM32CubeIDE for VS Code extension, which has allowed me to switch to using a modern build of Clang that has support for a lot of C23 features, including constexpr. It also has some extensions, and supports constexpr on struct arrays (which may be standardised in the next C version).

It's also nice to be able to specify the underlying type of enumerations when the width and signedness matter.

All posts are made in a personal capacityMISRA C++ ChairMISRA C WG MemberDirector The MISRA Consortium Limited (TMCL)