[cfe-dev] The size of a pointer to function.

John McCall rjmccall at apple.com
Thu Feb 7 10:14:52 PST 2013


On Feb 7, 2013, at 3:19 AM, Enea Zaffanella <zaffanella at cs.unipr.it> wrote:
> Question:
> is clang forcing a pointer to function to have the same size as a pointer to object?

Undoubtedly;  this assumption is likely pervasive throughout LLVM as well.
Even the standards only support the alternative in theory — none of the
portability headers offer specific support for function pointers that disagree
in size with object pointers.  Even the Itanium ABI would need some very
interesting tweaking if you changed this.

> Afaict, in both cases clang ends up querying TargetInfo::PointerWidth
> (unless the object is placed in a non-default address space).
> 
> What about differentiating behavior having, e.g.,
>  TargetInfo::getObjectPointerWidth()
> and
>  TargetInfo::getFunctionPointerWidth()
> ?

My only objection to this is that it's likely to be a massively invasive and
never-actually-completed porting effort, on the scale of the byte-size
refactor.

John.



More information about the cfe-dev mailing list