G
Gene Wirchenko
Is the following guaranteed safe?
void InitInt(int & SomeInt)
{
SomeInt=3;
return;
}
int main()
{
int MainInt; // not initialised!
InitInt(MainInt);
std::cout << MainInt << std::endl;
return 0;
}
The intent of the function is to initialise its parm, so why
bother initialising it first in main()? Unless, of course, it is not
safe. Is it safe?
Sincerely,
Gene Wirchenko
void InitInt(int & SomeInt)
{
SomeInt=3;
return;
}
int main()
{
int MainInt; // not initialised!
InitInt(MainInt);
std::cout << MainInt << std::endl;
return 0;
}
The intent of the function is to initialise its parm, so why
bother initialising it first in main()? Unless, of course, it is not
safe. Is it safe?
Sincerely,
Gene Wirchenko