Content deleted Content added
No edit summary |
m Reverted 1 edit by 71.94.154.159 (talk) to last revision by ClueBot NG. (TW) |
||
Line 5:
=== Programming convenience ===
Wrapper functions can be used to
Wrapper functions are useful in the development of applications that use third-party library functions. A wrapper can be written for each of the third party functions and used in the native application. In case the third party functions change or are updated, only the wrappers in the native application need to be modified as opposed to changing all instances of third party functions in the native application.
Line 13:
===Code testing===
Wrapper functions can be used to write [[Debugger|error checking]] routines for pre-existing system functions without increasing the length of a code by a large amount by repeating the same error check for each call to the function.<ref>{{cite book |title=UNIX Network Programming |last=Stevens |first=Richard |author2=Fenner, Bill |author3=Rudoff |author4= Andrew
A test driver is a kind of wrapper function that exercises a code module, typically calling it repeatedly, with different settings or parameters, in order to rigorously pursue each possible path. It is not deliverable code, but is not throwaway code either, being typically retained for use in regression testing.
An interface adaptor is a kind of wrapper function that simplifies, tailors, or amplifies the interface to a code module, with the intent of making it more intelligible or relevant to the user. It may rename parameters, combine parameters, set defaults for parameters, and the like.
===Multiple inheritance===
Line 19 ⟶ 21:
==Library functions and system calls==
Many [[Standard library|library]] functions, such as those in the [[C Standard Library]], act as [[Interface (computing)|interface]]s for [[Abstraction (computer science)|abstract]]ion of [[system call]]s. The ''fork'' and ''execve'' functions in [[glibc]] are examples of this. They call the [[low-level|lower-level]] ''[[Fork (operating system)|fork]]'' and ''[[execve]]'' system calls, respectively.
This may lead to incorrectly using the terms "system call" and "syscall" to refer to higher-level library calls rather than the similarly named system calls, which they wrap.{{fact|date=June 2016}}
==See also==
*[[Wrapper library]]
*[[Adapter pattern]]
*[[Decorator pattern]]
*[[Delegation (programming)]]
*[[Forwarding (object-oriented programming)]]
*[[Language binding]] wrapper to another language
*[[SWIG]] automatic wrapper generator
*[[Nested function]]
*[[Partial application]]
==References==
|