Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Currying in C

Name: Anonymous 2012-06-11 3:36

Hi /prog/, what's the standard technique to implement currying / bound function parameters in C (or i386 assembly)? I assume just allocate executable memory, copy in a stub and jmp into it? More elegant suggestions welcome

Are there any implementations of this technique for i386 / x86_64 / ARMv7? I've come across this paper [1] and this forum thread [2] but i havn't quite managed to hack anything together with a VirtualAlloc yet.

_________________________

1. http://asg.unige.ch/site/papers/Dami91a.pdf
2. http://arstechnica.com/civis/viewtopic.php?f=20&t=181415

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2012-06-11 3:56

You could probably do this generically in C++ with a lot of operator overloading and templating. A curried function is just a function with a few of its parameters already given values; an object seems like a good place to store them.

It's not something C programmers would do regularly.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List