AnsweredAssumed Answered

Use of _generic c99 Macro functionality

Question asked by Emiel Schimmel on Dec 2, 2015
Latest reply on Dec 20, 2015 by ZhangJennie

Hi,

 

I'm using codewarrior 10.5 build id 130916. My project is written in C.

The idea I did have was to add a _generic macro , to enable other files to only know\use just one interface definition.

For some reason it keeps complaining that the _Generic is unknown.

" error: expected ',' or ';' before '_Generic' "

 

 

call in c-file

[code]

int value1;

Function_GET2(value1)

BOOL value2

Function_GET2(value2)

[/code]

 

in the h-file:

[code]

void Function_GET_ValueA(BOOL item);

void Function_GET_ValueB(int item);

 

 

#define Function_GET2(X) _Generic((X), int: Function_GET_ValueA, BOOL: Function_GET_ValueB)(X)

 

[/code]

 

I have set the project C compiler to language standard ISO C99 with GNU Extensions, because I did read that _Generic was supported in version C99.

 

Therefore my question is what can I check\verify\change in Codewarrior that should be set to support the _Generic type.

Outcomes