Hello, I have the following code where I use the singleton design pattern, but I get the warning:
warning C4715: 'CM::Instance' : not all control paths return a value
How can I fix this warning?Code:CM& CM::Instance() { DWORD dwWaitResult = WaitForSingleObject(mutex, INFINITE); switch(dwWaitResult) { case WAIT_OBJECT_0: { static CM& inst = CM(); ReleaseMutex(mutex); return inst; } } return CM(); }




Reply With Quote