I have data file which i want to load during preprocessing .
DATAFILE :
CAR(C1, C2, C3)
There can be n number of cars (C1, C2....Cn), currently 3. The C1,.. are enums fields with specific value say C1=5, C2-8, c3-10.
I want to populate this data into a car array CAR_SUPPORTED[MAX_CARS]
such that
CAR_SUPPORTED[C1] = 1 and similarly for C2,C3.. so on.
I tried variadic macro as :
int CAR_SUPPORTED[] ={
#define CAR(...) __VA_ARGS__};
#include "car.data"
But this could just copy 5, 8 , 10 to 0,1,2 indexes .
how would I write a macro such that CAR_SUPPORTED[C1] = 1 and so on . Any suggestions ?