473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Can not find what I missed with return value

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?


Jun 27 '08 #1
2 1122
david kirjoitti:
//return UNDEFINED;
}
if there is something I could have missed
You forgot to uncomment that return.
Jun 27 '08 #2
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.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

108
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
0
by: JR | last post by:
Hi, i found a user control on the net see code below it is part of VSEssential but I like the coolProgressBar. Zo I want to use it into my program and I always get the error that it can't find...
26
by: Martin R | last post by:
Hi, How to find first not null value in column whitout chacking whole table (if there is a not null value then show me it and stop searching, the table is quite big)? thx, Martin *** Sent...
5
by: Draw | last post by:
Hi All, Just a thought, about the find() algorithm in the C++ STL. I read that the find algorithm can take a range of iterators. If it does not find the element it is looking for in that range...
8
by: ilikenwf | last post by:
I get 27 errors when I try to compile, none of which make sense to me, since the code looks good. I have my header file included, and all of my function definitions are in the class contained in the...
11
by: Ko van der Sloot | last post by:
Hello I was wondering which behaviour might be expected (or is required) for the following small program. I would expect that find( "a", string::npos ) would return string::npos but is seems to...
5
gekko3558
by: gekko3558 | last post by:
I am writing a simple binary search tree (nodes are int nodes) with a BSTNode class and a BST class. I have followed the instructions from my C++ book, and now I am trying to get a remove method...
22
by: ak | last post by:
Recently at an interview i was asked the following question : Assuming the function lookupName is defined, what's wrong with this code (hint: 2 bugs)? const char *getName(const char *c) {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.