c - Comparing defined raw data using preprocessor -


i have defined raw data in header file (which generated automatically), this:

#defined raw_data 0x11, 0x20, 0x55, 0x00, x044 

the aim check specific parameter of raw_data in compilation time , if wrong throw #error.

for instance, during compilation, preprocessor should check if 2nd parameter of raw_data (in case 0x20) 0x20, if not throw #error.

the main problem, how access specific parameter in defined raw_data, somehow possible?

p.s. using keil compiler in c.

#define raw_data 0x11, 0x20, 0x55, 0x00, x044 #define x_get_second_par(par) get_second_par(par) #define get_second_par(p1,p2,p3,p4,p5) p2  #if x_get_second_par(raw_data) != 0x20 #error "2nd parameter shall 0x20" #endif 

for specific parameter checking. it's not elegant.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -