Re: why this testcase compile failed for gcc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey
The C standard does not require that a function pointer use the same
representation as any other type of pointer.  In particular, on
processors with Harvard architectures, function pointers and regular
pointers are inherently different.
@Ian: do you have a reference section where this is described. I shortly tried to search for a few keywords in the standard, but couldn't find the obvious. I would just be interested in the details ...

@Steven: to give you a practical example: HP-UX on Itanium for example uses two different representations for data pointers and functions pointers: while data pointers are usual 64-bit addresses (purely assuming 64-bit compilation mode), function pointers however are pointers to a data structure called function description which contains two further pointers: (a) the final target address and (b) a so-called global data pointer for relative data addressing. Though if you would print out a function pointer on HP-UX, you would also get a single address, but it is NOT the address of the function to be called. This example is not as good as Ian's one, but is somehow similar, I think.

Best regards,
Andi


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux