[cfe-dev] Pointers to Overloaded C Functions
dgregor at apple.com
Fri Jan 15 22:17:11 CST 2010
On Jan 11, 2010, at 9:59 PM, George King <gwk.lists at gmail.com> wrote:
>>>> I am experimenting with clang's overloaded C functions, and I
>>>> can't figure out how to get a pointer to an overloaded function.
>>> Umm, interesting... I think it's just some missing logic in the
>>> code for assignments in C. I don't think anyone considered that
>>> someone might write code like that.
>> I don't know if we even want to support that kind of code... the
>> "overloadable" attribute is narrowly defined to help support
>> certain weird C99-isms (*cough* tgmath.h *cough*). We don't really
>> want to encourage widespread use, since it is likely to never be
> Thanks for your replies, and sorry for taking so long to respond. If
> it is valid to take the address of an overloaded function in C++,
> then it seems reasonable to expect that one could do so with the
> overload feature in C too. I understand that this is not a portable
> feature, but that is no reason not fully implement it (in the sense
> of completeness relative to C++).
Well, it's a reason not to fully implement it because a better
implementation encourages more use.
> I certainly don't expect this to be a priority for anyone;
> nevertheless, it seems weird to me that you could write functions
> but not be able to get their addresses due to syntactic limitations.
I would not oppose patches that make overloadable functions more
useful in C. But you won't see me jumping to implement them, either.
More information about the cfe-dev