Is it safe to for example do:
void AddTwo(int &num)
{
num +=2;
}
void ThreadProc(lpvoid arg)
{
AddTwo((int)arg);
}
Would it be saf
The real answer is - it depends...
On most platforms, yes it's safe as long as you don't do anything unsafe in the function which others have mentioned. It's easy to mess up so be careful!
On other platforms it's most definately unsafe. For example most C compilers for the smaller PIC microcontrollers can't support this due to hardware limitations.
In general, yes it's safe though.