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
  • In case you need to reserve space for a 'pointer to something', which can be either data or a function, you could use 'union'

    union

    {

        void (*function)();

        void *data;

    };

    Thus you should of course make some way to distinguish whether the pointer is a function or data pointer.

Reply
  • In case you need to reserve space for a 'pointer to something', which can be either data or a function, you could use 'union'

    union

    {

        void (*function)();

        void *data;

    };

    Thus you should of course make some way to distinguish whether the pointer is a function or data pointer.

Children
More questions in this forum