cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE - bug in compiler

Legacy member
Not applicable

Hi all,

You have one small bug in your compiler.

When I create macro like that:

#define CONV_STR2DEC(str, i) (str[i]>'0'?str[i]-'0':0)

const uint32_t version = CONV_STR2DEC(__TIME__, 6);

IDE return info that "initializer element is not constant" what is not true.

Your version of gcc thinks this is an expression, but I think they should try to interpret it first.

When I use GCC from Linearo, this problem not exist.

Best regards

Adrian

1 REPLY 1
Danish1
Lead II

I think it is highly unlikely that ST would modify a compiler provided by a third-party.

It is more likely that the difference arises because your code is being compiled to a different language (C vs C++) or a different version of the language e.g. C++11, C++14, C++17). Later versions were capable of doing more things at compile-time.

Hope this helps,

Danish