When developing the firmware for STM32 in IAR, I encountered the following:
typedef enum ll{
A = 0b00000000000000000000000000000000,
B = 0b00000000000000000000000000000011,
} lol;
Error[Pe067]: expected a "}" PROJ\Core\Src\main.c 72 (2d line)
But,
typedef enum ll{
A = 0x00000000,
B = 0x11111111,
} lol;
is compile successfully. I know all of this code work in another IDE n compilers. But what happens in my case? Why number with 0b brings errors? Maybe needed set some configure for compiler?
Binary literals (i.e. integers with the 0b
prefix, such as 0b010101
) are not part of the (standard) C language. However, they are part of C++ (since C++14), and some compilers (notably GCC) support them as an extension in C.