What does 'void *addr=(long *)0xffff0008'...

the "(long *)" part do in this line? I understand that the value at address 0xffff0008 is what the void addr pointer is pointing at, but I don't understand the (long *) . I know it's a long integer with a dereference operator, but not clear what it's role here is. Thanks.
It's typecasting the value 0xFFFF0008 to a long pointer.
I think in this case its a cast to a pointer to a long, i.e. it makes the compiler interpret the value 0xffff0008 as an address that points to a long, however I'm not sure why this is then cast to a void*. I guess the variable addr might need to be of that type at some point further on in the code, but I'm not sure why that couldn't have been achieved like this:

 
void* addr = (void*)0xffff0008;


There might be some issue with casting a literal numeric value to a void* (just guessing though).
Topic archived. No new replies allowed.