This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Address literals used pointers?
- From: "Steve Dondley" <stevedondley at attbi dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 24 Feb 2003 14:40:13 -0500
- Subject: Address literals used pointers?
Hi,
I know this is more of a C type question that a gcc question. If anyone can
recommend a good mailing list for basic C questions, I'm all ears.
Anyway...
I'm reading Kenneth Reek's excellent "Pointers on C". On p. 291, there is
some code that I'm a bit stumped by:
#define DISK_REGISTER (unsigned int *)0xc0200142
*DISK_REGISTER &= 0xfffffc1f;
This *DISK_REGISTER expression appears to perform indirection on a literal
cast as a pointer. Is this an accurate description of what's happening?
Can someone point me to a place where I can learn more about this cast?
I want to learn more but the syntax isn't explained in the book and Google
isn't helping. I can't duplicate the code because I keep getting a
segmentation fault when I try it out and so I'm curious to know how one can
get a bit of code like this to work without causing a segmentation fault.
Does the operating system designate some addresses (driver addresses, for
instance) outside the bounds of program memory as writable?