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

John McCall rjmccall at apple.com
Thu Feb 7 10:45:49 PST 2013

On Feb 7, 2013, at 10:14 AM, John McCall <rjmccall at apple.com> wrote:
> 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.

To clarify this point, I'm aware that there are platforms with this property
and that they presumably have C compilers.  I'm just saying that the
headers don't really go out of their way to make this easier.

>> 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.

And to clarify *this* point, if somebody has an actual plan to introduce an
LLVM backend for one of those platforms, then obviously this work
would be welcome.  I just don't really see the point in supporting it in the


More information about the cfe-dev mailing list