Say I have a structure acting as a register map.
typedef struct{
int reg1;
int reg2;
} regs;
and I have a few constant addresses for my registers
# define ADDR1 0x60000000
# define ADDR2 0x70000000
# define ADDR3 0x80000000
# define ADDR4 0x90000000
And to make things easier to loop through, I would like to put these in an array
regs * reg_list[4] = { ADDR1, ADDR2, ADDR3, ADDR4 };
When I compile this with gcc and -wAll, I get the following warning for each element in the array. I'm trying to get rid of this warning.
warning: initialization makes pointer from integer without a cast
I could type cast each individual address to reg* but that just seems very verbose. Is there a better way?
struct regs, however you put in each cell a pointer not to astruct regsstruct regs