Results 1 to 5 of 5

Thread: Question about a warning

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    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.

  2. #2
    Addicted Member
    Join Date
    Jul 2000
    Location
    California
    Posts
    154
    Looks like it.
    The loop can not end.
    VB-World addict!

    All spelling errors are undocumented words!
    http://www.bells.f2s.com

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  5. #5

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    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
  •  



Click Here to Expand Forum to Full Width