ITTONE Création des applications Web

generics – The use of _Generic dont work using Softune C Compiler

I did a lot of searches in the forums about the problem I have to use _Generic primary expression in my code.
I wrote a macro to get the data type of variable using the _Generic functionality:

#define CHECK_DATA_TYPE(x) _Generic((x), /* Get the name of a type */
u8 : DATA_TYPE_U8,
s8 : DATA_TYPE_S8,
u8 : DATA_TYPE_U16,
s8 : DATA_TYPE_S16,
u8 : DATA_TYPE_U32,
s8 : DATA_TYPE_S32)

so far in the code, I call the macro :
u8 test = 10;
u8 val = CHECK_DATA_TYPE(test);
So, I have a compilation error which indicate that the _Generic function is not defined:

W1020B: warning: identifier “_Generic” is undefined
E4254B: type name is not allowed
E4018B: expected a “)”
E4065B: expected a “;”

Any ideas?
It’s important to indicate that I compiled my project using Softune C Compiler.

Product of the Month September 2016

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *