side effect of calling a function without specifying anywhere for the return value
Hi,
Sorry about the title.
I've just come across some code that I wrote a long time ago. I know the code is wrong and needs fixing, but I'm trying to ascertain if it could be the cause of my problem... as follows..
What will happen at runtime with the following snippet...
Code:
int fnc(int arg1)
{
int retval;
....
return somevalue;
}
fnc(1);
(i.e not calling fnc with a variable or a cast).
I am asking as, after calling this snippet a few million times, I am seeing strange behavior - seemingly at random - appearing in the program.
The code has been running on various computers for over 10 years, but we are just seeing the behavior recently.
It's hard to explain, but seems to start with variable (static data) corruption.
Many Thanks,
Ian