Echoing what duffymo said with an example from the current version of some source code (bare minimum changes to conceal the guilty):
/*
=========================================================================
Function: int loadmsg (void)
Inputs: void
Outputs:
Returned Value: FUNCSUCC or unknown message number
Purpose: loads text of all messages into menus, strings, and
Description:
loadmsg() tests if message files can be found and accessed
Notes:
Functions Called:
loadstr()
Called By:
sys_startup()
Constants Used:
Global Variables Referenced:
iFLAG
Local Variables:
cc return value from rldinit
========================================================================
*/
static mint
loadmsg()
{
register mint cc;
if (cc = rldinit())
return(cc);
return FUNCSUCC;
}
Indentation is accurate (that is, as in the actual code). How to deconstruct?
- The macro FUNCSUCC is 0.
Consequently, the body of the function is equivalent to:
return rldinit();
The leading comments are almost all superfluous.
- The function loadstr() is not called - it doesn't exist.
- The variable iFLAG is not referenced.
- The inputs and outputs are immaterial.
- In fact, the whole function is called once - so the calling function may as well call rldinit() directly.
- This function is deleted in my working branch.
- This was 43 lines between the open comment and end of function - in place of a function call.
I wish it were an isolated instance. No, it isn't a file I work on primarily. It is, however, a file of just over 20,300 lines (and it isn't even the biggest maintained - as opposed to generated - source file in the system). No-one knows all of what's in it - and therefore no-one is responsible for spotting such problems. I do this sort of problem spotting rather consistently, but by accident when I have to look at the code.
(Another bugbear of mine: 900 of the 20,300 lines have trailing blanks on them. I hate that!)