Re: Formatting of function pointer value

Vladimir Prus
2005-07-11T07:11:19Z

Vladimir Prus wrote:

> Daniel Jacobowitz wrote:
>
>> On Fri, Jul 08, 2005 at 12:50:48PM +0400, Vladimir Prus wrote:
>>> Vladimir Prus wrote:
>>>
>>>
>>> > the value of *p3 is printed like this:
>>> >
>>> > (gdb) print *p3
>>> > $1 = {int (int)} 0xb7ee6e9c <__DTOR_END__+4>
>>>
>>> Even more strange is this:
>>>
>>> (gdb) print p3
>>> $2 = (int (*)(int)) 0xb7ee6e9c <__DTOR_END__+4>
>>> (gdb) print *p3
>>> $3 = {int (int)} 0xb7ee6e9c <__DTOR_END__+4>
>>>
>>> Why does formatting of the type different in the second case, and uses
>>> braces instead of parenthesis?
>>
>> One is a pointer to function, the other is a function.
>
> I'm sorry, I don't understand this. Is human user supposed to know that
> '{' starts a function? What harm will it make if parenthesis are used in
> both cases?

BTW, the code in question says:

/* FIXME, we should consider, at least for ANSI C language,
eliminating the distinction made between FUNCs and POINTERs to
FUNCs. */
fprintf_filtered (stream, "{");
type_print (type, "", stream, -1);
fprintf_filtered (stream, "} ");

Is "FIXME" still relevant?

- Volodya