Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
dereferencing a void pointer to a memory mapped address space of a HW device leads to what result?
Posted
Comments
Richard MacCutchan 7-Nov-14 6:46am    
Try it and see.
Emre Ataseven 7-Nov-14 7:28am    
The compiler will not let you dereference a void* pointer because it does not know the size of the object pointed to, you need to typecast your pointer to the right type before you dereference it.

1 solution

First and foremost, as Emre Ataseven answered, no compiler can dereference a void* pointer wothout a cast.

For your question it really depends on the architecture but in the general case the OS won't allow you taht because Memory Mapped addresses are right under the protective wing of the kernel - you need to use APIs to access to that locations. Normally you cannot dereference any memory location that isn't within your process memory.

Of course if you are working in kernel mode or in a microcontroller things are different, as any address is accessible.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900