Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Can not find wh...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 45755 of 45898
Post > Topic >>

Can not find what I missed with return value

by david <David.Abdurachmanov@[EMAIL PROTECTED] > May 4, 2008 at 11:23 PM

I wrote one function which is used to count comment and code lines and
it works as it should be, but when compiling I get warning (i686-apple-
darwin9-g++-4.0.1):

pirma.cpp: In function =91int CheckLine(const std::string&, int&)=92:
pirma.cpp:112: warning: control reaches end of non-void function

So, it looks like somehow it still can get to the end of the function,
the problem is that I can not figure out that I could have missed.
This way I added return UNDEFINED at the end of the function, but I
still would like  to get the answer what I could have missed.

The whole function has only new local variables and if structure:
int CheckLine(const string &line, int &status) {
    string::size_type startPos;
    bool emptyStatus =3D true;

    if (status =3D=3D CODE || status =3D=3D EMPTY) {
        ...........
    } else {
        .........
    }
    //return UNDEFINED;
}

if there is something I could have missed, it would be in the else
statement, but it looks perfect for me. Any ideas?




 3 Posts in Topic:
Can not find what I missed with return value
david <David.Abdurachm  2008-05-04 23:23:20 
Re: Can not find what I missed with return value
Krice <paulkp@[EMAIL P  2008-05-04 23:31:12 
Re: Can not find what I missed with return value
david <David.Abdurachm  2008-05-04 23:36:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 17:07:39 CDT 2008.