This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C Programming and pointer sizes on ARM processors.

Hi,

I've a question regarding C programming on ARM processors. can I ALWAYS assume that the sizeof(function_pointers) == sizeof(void *) == sizeof(char *)? Also I read in a blog (Caches and Self-Modifying Code) that "ARM architecture is often considered to be a Modified Harvard Architecture" does this mean the instructions are placed in a different memory space than the data memory space?  If so again how can we guarantee the sizeof (function_pointer) == sizeof(data_pointer)?

Thanks.

Parents
  • Hi asp,

    do you want to make the self-modify-code? If it is so, you can use the type casting of the function and data pointers each other.

    volatile void (*func)();
    volatile char *dat;
    main()
    {
      func = (volatile void (*)())dat;
      dat = (volatile char*)func;
    }
    


    Best regards,
    Yasuhiko Koumoto.

Reply
  • Hi asp,

    do you want to make the self-modify-code? If it is so, you can use the type casting of the function and data pointers each other.

    volatile void (*func)();
    volatile char *dat;
    main()
    {
      func = (volatile void (*)())dat;
      dat = (volatile char*)func;
    }
    


    Best regards,
    Yasuhiko Koumoto.

Children
No data