K
Keith Thompson
Flash Gordon said:Keith Thompson wrote, On 05/09/07 21:33:Sorry, I missed the declaration of f in the previous article:Keith Thompson said:[...]
Under AIX a function pointer is two pointers:
1) The pointer to the code
2) The pointer to the global section of the function, i.e. the
value that will be loaded in a dedicated register for accessing
the global variables.
When you take the address of a function, the compiler generates a
structure with those two pointers, and gives you a pointer to THAT
structure, specially if you write
sizeof(f*)
instead of sizeof(f);
You are mistaken. [snip]
What do you mean by 'sizeof(f*)' and 'sizeof(f)'? What is 'f'?
typedef int f(void);
sizeof(f*) is, of course, a constraint violation.
Surely you mean sizeof(f) is a constraint violation because it is
taking the size of a function type, whereas sizeof(f*) is legal
because i is taking the size of a pointer to a function.
No, I meant what I said. I was completely wrong, but I meant it.
Seriously, you're quite correct; thanks for catching my error.