What is a 'thunk'?

后端 未结 10 934
日久生厌
日久生厌 2020-11-28 01:42

I\'ve seen it used in programming (specifically in the C++ domain) and have no idea what it is. Presumably it is a design pattern, but I could be wrong. Can anyone give a go

10条回答
  •  孤街浪徒
    2020-11-28 02:02

    The word thunk has at least three related meanings in computer science. A "thunk" may be:

    • a piece of code to perform a delayed computation (similar to a closure)
    • a feature of some virtual function table implementations (similar to a wrapper function)
    • a mapping of machine data from one system-specific form to another, usually for compatibility reasons

    I have usually seen it used in the third context.

    http://en.wikipedia.org/wiki/Thunk

提交回复
热议问题