tags:

views:

149

answers:

2

What is meant by redundant function? What is the difference between a redundant function & an inline function?

+1  A: 

A redundant function is one which has potentially been superseded by another function, and shouldn't be used anymore. I guess it can be thought of in the same way as a deprecated function.

An inline function, in C and C++, is one which is implemented in the header file rather than the .c or .cpp file. The compiler will replace all calls to that function with the function body itself, rather than linking to it via the symbol table. This will make the compiled binaries bigger, but it has the advantage that the function will run a little bit faster.

LeopardSkinPillBoxHat
+1  A: 

Another meaning of redundant function is to have two functions doing basically the same thing:

function Foo(x) { return x * x / 2; }
function Bar(x) { return Math.sqr(x) * 0.5; }

or same content in different packages, etc.
As shown, they can be slightly different in behavior (float vs. int, etc.) so one must be careful when pruning them...

PhiLho