I need know what is the size of a address of one variable, in other words, how much bytes I need to store the address of a variable (in compilation time).
Unhappily not is possible use sizeof in define pre-processors, like this:
#define ADDRESS_SIZE sizeof(void *)
So, I try this:
#define ADDRESS_SIZE ((char *)((void**)0 + 1) - (char*)(void**)0)
Apparently this work but, in this way I cannot do this test:
#if ADDRESS_SIZE == 4
typedef uint32_t address_pointer;
#endif
#if ADDRESS_SIZE == 8
typedef uint64_t address_pointer;
#endif
This return the error: "operator '*' don't have operator to right"
Can anyone help me with this problem?
Thanks,
Ricardo.