What is a "Thunk?"
There seem to be several alternate definitions of the term:
Thunk Is Past Tense of Think.
Is Call By Name function arguments, evaluated in the called function, a la Algol 60
I like to think of a thunk as a very small routine for calling another routine. This encompasses Call By Name thunks as well as (I think) the 16/32-bit calls. Routines that are basically wrappers for another, but with less parameters (providing defaults), would also be thunks under this definition. It's probably not what most people would call it, but it works for me! -- Matthew Tuck
[16/32-bit calls would be Thunk Toa Different Address Space.]
Along these lines Jamie Zawinski uses "thunk" to refer to the parts of XScreenSaver code that implement XLib in terms of OS X Cocoa graphics, or that implement a OpenGL 1.5 in terms of OpenGL ES 2.0.
(v) In PCs, to convert a 16-bit memory address to a 32-bit address, and vice versa. Thunking is necessary because Intel's older 16-bit microprocessors used an addressing scheme called segmented memory, whereas their new 32-bit microprocessors use a flat address space . Windows 95 supports a thunk mechanism to enable 32-bit programs to call 16-bit DLLs. This is called a flat thunk. On the other hand, 16-bit applications running under Windows 3.x and Windows for Workgroups cannot use 32-bit DLLs unless the 32-bit addresses are converted to 16-bit addresses. This is the function of Win32s, and is called a universal thunk.
According to folklore, the term thunk was coined by the developers of the Algol-60 programming language, who realized late one night that the data type of parameters could be known with a little forethought by the compiler. That is, by the time the compiler processed the parameters, it had already thought (or thunk) of the data types. The meaning of the term has changed considerably in recent years.
When I asked this question of a MS guru during my visit to "Greater Redmond" in 1987 (OS/2 Developer's Convention), he replied that it was "imitative of the sound of a transmission, shifting from a high gear to low abruptly" and could be used to describe calls between 16-bit and 32-bit spaces, the method used to reset the 80286 on-the-fly to get from protected mode back to real mode under OS/2, and other interfaces of this kind, used to bridge essentially incompatible modes or spaces.
See original on c2.com