According to the standard, is it legal to access data from a function pointer?
Sort of:
#include <stdio.h>
int test(){
}
int main() {
int (*fp)(void) = &test;
int i=0;
for(i; i<10; ++i)
printf("%x", *(fp+i));
}
Works on ideone , it seems to work - but I wonder if this is expected, or will it be determined by the implementation, and the page can be protected from reading the OS?
source
share