-
Question about a warning
I am using Boland free compiler 5.5 and I get this warning:
Warning W8066 test.cpp 11: Unreachable code in function main()
This is the code:
PHP Code:
#include <stdio.h>
#include <windows.h>
int main()
{
while (true)
{
printf("test\n");
Sleep(100);
}
return 0;
}
Does this just mean the program won't end?
-
Looks like it.
The loop can not end.
-
It's a bit more generic than that, because it will probably be flagged by the following code as well:
Code:
void func() {
if(true) {
cout << "Hello" << endl;
} else {
cout << "Not called" << endl;
}
}
-
does the code that is unreachable not compile and not say find template parameters invalid due to used operations in such code block?
-
No, it compiles fine. I just wanted to make a program that keeps checking for something and if it is true then call a function.