On 21.01.22 13:55, ag0aep6g wrote:
On 21.01.22 13:33, Mike Parker wrote:
### Mathias
Mathias would very much like to see the unification of delegates and
function pointers. There was general agreement that this is a good
goal to aim for. Mathias subsequently informed me he will look into it
once some other things are off his TODO list if no one else gets to it
first.
I still believe it should be fairly simple:
https://forum.dlang.org/post/ofc0lj$2u4h$1...@digitalmars.com
Proof of concept:
https://github.com/aG0aep6G/dmd/commit/aa0563a49536e42fe9b2c1c2d540a7f1f1b075d4
With that tiny patch, this works:
----
void func(int x, int y)
{
import core.stdc.stdio: printf;
printf("%d %d\n", x, y);
}
void main()
{
void delegate(int x, int y) dg;
dg.funcptr = &func;
dg(1, 2); /* prints "1 2" */
}
----