2025-10-14 7:31 AM - last edited on 2025-10-14 7:56 AM by Andrew Neil
Defining the underlying type of an enumeration has been a difficult task until C23 added the feature. Previously different compilers used different methods and results could vary unexpectedly.
As seen in the image below, STM32CubeIDE v 1.19.0 can recognize this C23 feature and flag mistakes, such as the out-of-range value 0x101 for the 8-bit enum.
As seen in the gcc output below, the mistake is caught by gcc:
This is all as it should be. The problem is when I remove the fake out-of-range command, gcc works as expected but STM32CubeIDE flags a syntax error:
The build finished with no errors or warnings so gcc 13 understands at least this part of the C23 standard.
Is there a configuration within STM32CubeIDE to prevent displaying a Syntax error for code the compiler understands?
PS
I checked the generated assembly and it appears that the correct 8-bit code (ldrb) is being generated:
2025-10-14 7:37 AM
Hello @StevenG
First let me thank you for posting.
I'm currently checking this . I will get back to you asap.
THX
Ghofrane
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.