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

Re: RFC: Support non-standard extension (call via casted function pointer)



On 26.01.2016 00:39, Andreas Schwab wrote:
> Michael Karcher <debian@mkarcher.dialup.fu-berlin.de> writes:
>
>> *can't* (forward-)declare a function without fixing the return type.
> What does "fixing the return type" mean in the context of lying to the
> compiler?
OK, now I get your question. I don't mean fix in the sense of "repair"
(third verb meaning on https://en.wiktionary.org/wiki/fix). I do mean
"fix" as "not keeping it variable" (eleventh verb meaning on
https://en.wiktionary.org/wiki/fix).

As soon as you are trying to tell gcc that "there is an external
function named foo", you need to tell the compiler what return type it
has. ghc does not have the information yet when it writes the
declaration. So the theoretically correct action would be to declare a
function with an unknown return type. As this is not possible, ghc
programmers resorted to lying to the compiler specifying a fixed return
type.

Regards,
  Michael Karcher


Reply to: