J
Jeff Schwab
int main()
{
char const* const p =
static_cast< char const* const >( 0xffffffff );
}
Fails to compile with g++; message is:
g++ -c -o main.o main.cc
main.cc: In function `int main()':
main.cc:3: error: invalid static_cast from type `unsigned int' to type
`const
char* const'
make: *** [main.o] Error 1
Why doesn't this work? How can one write to specific addresses? For
example, Lupher Cypher posted a C-style cast to "char* far", in an
attempt to write to a text display. I'm willing to accept that "far"
might be a necessary extension for some architectures, e.g. 16-bit chips
in PDA's with 32 MB of RAM. On such an architecture, he may well need
to write data directly to particular addresses in order to communicate
with a memory-mapped device; how is he supposed to do it? Are the old
C-style casts the only way?
Special thanks to anyone with experience on this issue.
-Jeff
{
char const* const p =
static_cast< char const* const >( 0xffffffff );
}
Fails to compile with g++; message is:
g++ -c -o main.o main.cc
main.cc: In function `int main()':
main.cc:3: error: invalid static_cast from type `unsigned int' to type
`const
char* const'
make: *** [main.o] Error 1
Why doesn't this work? How can one write to specific addresses? For
example, Lupher Cypher posted a C-style cast to "char* far", in an
attempt to write to a text display. I'm willing to accept that "far"
might be a necessary extension for some architectures, e.g. 16-bit chips
in PDA's with 32 MB of RAM. On such an architecture, he may well need
to write data directly to particular addresses in order to communicate
with a memory-mapped device; how is he supposed to do it? Are the old
C-style casts the only way?
Special thanks to anyone with experience on this issue.
-Jeff