I was going through a header file of a micro-controller, when i found this,
#define DEFA(name, address) __no_init union \
{ \
struct \
{ \
volatile unsigned char name##_L; \
volatile unsigned char name##_H; \
}; \
struct \
{ \
volatile unsigned short name##L; \
volatile unsigned short name##H; \
}; \
__ACCESS_20BIT_REG__ name; \
} @ address;
I have multiple questions here,
- I didn't know that we can use union and structures within #define statements. How are they interpreted by the compiler?
- What does "name##_L" and "name##L" mean.?, especially "##".
- What is "__ACCESS_20BIT_REG__ name"?
- What is this new "@" symbol, I googled to find out about this symbol, and i find nothing related to the @ symbol anywhere, some people say that this is not C standard, is this true?, and what does it mean?
Someone, please explain me this peace of code, everything depends on this piece of the code, and everything either directly or indirectly uses this #define. :(