Hi guys
I find myself need to make a struct and union thing all the time like this:
And I find myself often need to add or remove member in a struct, and I need to change the array size manually all the time. Is there a way to automate this process?? For example:
I find myself need to make a struct and union thing all the time like this:
Code:
typedef struct{
union{
struct{
uint32_t foo_1;
uint32_t foo_2;
}test_t;
uint32_t data[2];
};
}foo_t;
Code:
typedef struct{
union{
struct{
uint32_t foo_1;
uint32_t foo_2;
// ...
uint32_t foo_n;
}test_t;
uint32_t data[sizeof(foo_t)];
};
}foo_t;