Can not find what I missed with return value

D

david

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 ‘int CheckLine(const std::string&, int&)’:
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 = true;

if (status == CODE || status == 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?
 
D

david

I am not that silly, I commented it that I could check/change code to
locate. But it looks that I found what I was looking after making
large scale tests.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top