·  COMMON – Function Stub

 

- Info:

  - Function stub is function implementation but with dummy code.

  - Function stub is placeholder for function implementation when interface is known but implementation is not yet ready.

  - Function stub contains just enough code to allow it to be compiled and linked with the rest of the program.

  - Function stub is used when developing code which needs to call some other function which implementation is not ready

    To avoid waiting for this function to be ready dummy function, called stub, is created allowing partial code testing.

  - Function stub is also used when your program needs to call function from some library like DLL.

    When the program is run, stub is replaced by acctaull implementation from that DLL.

  - This info is based on http://en.wikipedia.org/wiki/Method_stub.

 

- Example:

  - Following is C example of Function Stub containing dummy code which always prints out the same result ignoring input parameters.

 

    void addNumbers(int p1, int p2) {

      printf("Result is 10. \n");

    }