Why are function pointers and data pointers incompatible in C/C++?

I have read that converting a function pointer to a data pointer and vice versa works on most platforms but is not guaranteed to work. Why is this the case? Shouldn't both be simply addresses into main memory and therefore be compatible?


An architecture doesn't have to store code and data in the same memory. With a Harvard architecture, code and data are stored in completely different memory. Most architectures are Von Neumann architectures with code and data in the same memory but C doesn't limit itself to only certain types of architectures if at all possible.

Need Your Help

Suppress the “unused” warning for a method, but not the variables within it

java suppress-warnings

As the title asks, how do I suppress the warning for just the method? Is this possible?

what does this regular expression mean in lex

regex lex

i am studying lex and yacc from an o'reilly book and i came across a lex example which handles commands, numbers, strings and new lines, ignoring white space and comments.