Please give this a try. Defining RELEASE
as zero(0) or one(1) will directly impact the length of array filtered_data
... smaller if RELEASE
==1 ... which assumes you do Not want the full array of data for production/release.
Compiles and runs in both modes ( RELEASE
1 or 0 ); tested in Visual Studio just now.
#include <stdio.h>
#define RELEASE 0
#if RELEASE
#define MACRO_DATA 0
#else
#define THRESHOLD 5
#define MACRO_DATA \
X( 1 ) \
X( 8 ) \
X( 3 ) \
X( 12 ) \
X( 5 )
#define X(value) ((value) >= THRESHOLD ? value : -1),
#endif //RELASE
// Generate filtered array
int filtered_data[] = { MACRO_DATA };
int main()
{
printf("%d\n", filtered_data[0]);
return 0;
}