Speaking of hard to find errors...

Tim W Smith ts at cup.portal.com
Thu Apr 18 16:56:46 AEST 1991


Here's a code fragment that can cause a lot of grief:

	struct spam {
		...
	}		/* Oops!  Forgot semicolon! */

	function()
	{
		...
	}

The programmer is letting the return type of the function default
to int, but the missing semicolon makes this instead become a
function that returns a struct spam.

Depending on how your compiler implements structure return,
results can range from callers of function getting wrong
return values to a trashed stack.

						Tim Smith



More information about the Comp.lang.c mailing list