My program creates a thread but I'm getting a "Don't use C-style casts" in my code analysis with Visual Studio.
#include <windows.h>
#include <process.h>
#include <iostream>
void myThread(void * threadParams)
{
int* x = (int*)threadParams;
std::cout << "*x: " << *x;
}
int main()
{
BOOL bValue2 = TRUE;
_beginthread(myThread, 0, (LPVOID)&bValue2);
Sleep(10000);
}
I tried static_cast<LPVOID>&bValue2
but it gives an error.
What is the proper format for casting in _beginthread
?
Here is an example :