What does this macro do? I am not able to understand its definition:
#define PAIR(def) [def] = { .name = #def, .val = def, },
From : ltp-full-20120401/lib/tst_res.c line 183
You can get the source from this link
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It looks like it is used to initialize an array of structs.
the macro used as follows
PAIR(FOOBAR)would expand to:.nameand.valwould be members of thestructtype of the array elements.