|
-
May 26th, 2010, 01:20 PM
#1
Variable used without being initialized?
Why would this code be throwing the "run-time check failure #3 - the variable 'SQLStrtTime' variable is being used without being initialized" error?
===============================================================
UINT SQL_Thread(LPVOID param)
{
LARGE_INTEGER SQLFreq;
LARGE_INTEGER SQLStrtTime;
LARGE_INTEGER SQLCurrTime;
double SQLDiff;
bool SQLInitTimer1;
for( ;; )
{
// Read/Write SQL Data From/To Database (every 500ms)
if (SQLInitTimer1 = false)
{
QueryPerformanceCounter(&SQLStrtTime);
SQLInitTimer1 = true;
}
else if (SQLInitTimer1 = true)
{
QueryPerformanceCounter(&SQLCurrTime);
QueryPerformanceFrequency(&SQLFreq);
SQLDiff = ((double)(SQLCurrTime.QuadPart - SQLStrtTime.QuadPart) / (double)(SQLFreq.QuadPart)) * 1000;
if (SQLDiff >= 500)
{
UpdateSQL();
SQLInitTimer1 = false;
}
}
}
return 0;
}
================================================================
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|