...
Wiki Markup |
---|
If a function pointer is set to refer to an incompatible function , invoking that function via the pointer may cause unexpected data to be taken from the process stack. As a result, unexpected data may be accessed by the called function \[[DCL35-C. Do not convert a function pointer to a function of an incompatible type]\]. |
Non-Compliant Code Example: (function pointers)
In this example, the function pointer fn_ptr
is set to refer to the function add()
, which accepts three integer arguments. However, fn_ptr
is specified to accept two integer arguments. Setting fn_ptr
to refer to add()
results in an unexpected program behavior.
...