cannot pass argument `& callback` of type `extern (C) int function()` to parameter `extern (C) int function()`

Dennis dkorpel at gmail.com
Wed May 27 10:29:06 UTC 2026


On Wednesday, 27 May 2026 at 09:52:58 UTC, Daas wrote:
> ````c
> // src/test.c
>
> typedef int(*fp)();
>
> int run(fp fn) {
>   return fn();
> }
> ````

That defines a function pointer with old K&R C-style variadic 
functions. Try:

```C
typedef int(*fp)(void);
```

The conversion from K&R variadic to void parameter list should 
probably be allowed by the compiler, and if not, at the very 
least that uninformative error message should be improved. Filed 
as https://github.com/dlang/dmd/issues/23177


More information about the Digitalmars-d-learn mailing list