|
-
Aug 20th, 2001, 08:16 PM
#1
Thread Starter
Fanatic Member
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?
Alcohol & calculus don't mix.
Never drink & derive.
-
Aug 21st, 2001, 12:52 AM
#2
Addicted Member
Looks like it.
The loop can not end.
-
Aug 22nd, 2001, 09:27 AM
#3
Monday Morning Lunatic
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;
}
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 22nd, 2001, 10:31 AM
#4
transcendental analytic
does the code that is unreachable not compile and not say find template parameters invalid due to used operations in such code block?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 26th, 2001, 05:24 PM
#5
Thread Starter
Fanatic Member
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.
Alcohol & calculus don't mix.
Never drink & derive.
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
|